8 2 2 arrays are mutable c2 b6

Solutions on MaxInterview for 8 2 2 arrays are mutable c2 b6 by the best coders in the world

showing results for - "8 2 2 arrays are mutable c2 b6"
Yusuf
01 Oct 2017
1/*In programming, mutability refers to what happens when you attempt to
2change a value. Remember that strings are immutable, meaning that any
3change to a string results in a new string being created. In contrast, 
4arrays are mutable, meaning that individual items in an array can be 
5edited without a new array being created.*/
6
7//Update an item in an array using bracket notation and index.
8let javaScriptFrameworks = ["React", "Angular", "Ember"];
9console.log(javaScriptFrameworks);
10
11// Set the value of index 2 to be "Vue"
12javaScriptFrameworks[2] = "Vue";
13
14// Notice the value at index 2 is now "Vue"
15console.log(javaScriptFrameworks);
16
17//[ 'React', 'Angular', 'Ember' ]
18//[ 'React', 'Angular', 'Vue' ]