Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
// declare numbers array using const
const myNumbers = [1, 2, 3]
/*
add a new number to the array
no error will occur, because we did not
"reassign" a new value to our myNumbers
array using `=`
*/
myNumbers.push(4)
console.log(myNumbers) // [1, 2, 3, 4]
/*
However, uncomment the line below and observe
the error when we attempt to "reassign" myNumbers
*/
// myNumbers = [4, 5] // an error will occur
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x