var mutableArr = [1, 2, 3, 4]; arr.push(5); console.log(mutableArr); // [1, 2, 3, 4, 5] 

A typo?

https://habrahabr.ru/company/devexpress/blog/302118/ (first example) https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push (mdn ref )

  • Why do you think a typo? It seems that's right. - Andrey
  • four
    Typo, certainly. The usual thing, at first, the author called the variable arr , then decided to rename it for greater clarity, but by mistake it was not renamed everywhere. :) - Yaant
  • A typo. Must be mutableArr.push (5); - coder675

0