Pop - Array Methods - Javascript Tutorial

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

hello sir i got to ask u a question what is the difference between this syntax
var x = ['hello', 'world'].pop();
console.log(x); // this gives the output world


and this


var x = ['hello', 'world'];
x.pop();
console.log(x)
// why this won't give the same output as 'world';


the question im asking is both the pop() methods have been assigned equally for the both examples equally yet it gives two outputs why this happens

manojsamath