0
Undefined Error in array.push after putting it in a variable then printing the value in the variable it in console
I am getting an undefined error when I make a new variable in JS and gave it the value array.push() and when i try to print the value of that variable in console.log(variable), I get an undefined error. Please help me and if possible explain to me as to why I am getting this. https://code.sololearn.com/W1NAxMElpbEM Thanks in Advance.
2 ответов
0
push() returns the size of <prices> after you push a new item into it. The value (array size) returned is of a number type, which doesn't have a `length` property. Hence 'undefined' with your attempt to log price1.length
+ 1
Thanks 😊