javascript - Console.log() inside a for-loop -


i wonder problem code below. when use console.log(a[0]), console shows me first element of array a. but, when use console.log(a[i]), not work. expect in case i = 0 same value when use console.log(a[0]). has push fucntion or locate error?

thx help!

var = []     ( var = 0; < links.length; i++) {        a.push(b[i]);     console.log(a[0]); // works     console.log(a[i]); // doesn't work      }) 

you missing code. links , b, in particular.

let = [];  let b = ['foo', 'bar', 'baz'];  let links = ['foo', 'bar', 'baz'];  (let = 0; < links.length; i++) {    a.push(b[i]);    //console.log(a[0]); // works    console.log(a[i]); // works  }


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -