I'm trying to build skills in using local variables. To make a variable local, I declare it within the function that I want to use it in, right?
But if I'm using this function very often, won't I be declaring this variable over and over? Is this OK or not?
For example if I have a function like this:
function myFunction() {
var myVariable;
// some code that requires myVariable
}
...I'm going to be declaring myVariable every time. Will this cause space in memory to be set aside for myVariable every time the function is called? Is there a way around this?