+ 1
Why we can access function created outside the function but cant access variable or value outside the function?
JAVASCRIPT problem i faced while solving problem of creating calculator
1 ответ
+ 2
If you want to acces a variable outside a function, make it global.
https://www.sololearn.com/discuss/1465290/?ref=app
var variableOne = [
"newVarone",
"newVartwo",
"newVarthree",
1000
];
var variableTwo = new Var();
variable[0] = "newVarone";
variable[1] = "newVartwo";
variable[2] = "newVarthree";
variable[3] = 1000;
var variableThree;
function() {
console.log(variableOne[1]);
console.log(variableTwo[2]);
console.log(variableThree = "newVar");
}
Hope it helps👍