Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

access variable outside for loop javascript

var x = [];
var y = [1,2,3,4]// see the change here
    
var i;
for (i = 0; i < y.length; ++i) {
    x.push(y[i]); // push every element here
}
console.log(x);
 
PREVIOUS NEXT
Tagged: #access #variable #loop #javascript
ADD COMMENT
Topic
Name
3+1 =