JavaScript Array Question 5

Introduction

What is the output of the following code?


let people = [//from   w w  w  .ja  v  a 2s. co  m
  ["CSS", 25, true],
  ["HTML", 34, false],
  ["Javascript", 51, true]
];

let newPeople = people;

console.log("Person #2 name: " + newPeople[1][0]);

// Modify the original array
people[1][0] = "New Value";

// Let's re-check the 2nd name in the NEW array
console.log("Person #2 name, again: " + newPeople[1][0]);


Person #2 name: HTML
Person #2 name, again: New Value



PreviousNext

Related