Arrays in Functions Explained, Understanding Arrays and Functions on Codecademy's Learn JavaScript

In this JavaScript lesson, we look at, “Arrays in Functions Explained, Understanding Arrays and Functions on Codecademy’s Learn JavaScript”. This is from the Arrays section from our Codecademy course. In it, we learn that Arrays that are changed within a function will be updated outside our function. It is important to understand that if you mutate or change your Array within a function, that function will stay changed, or mutated, outside of that function. We see two examples of this. In the first example we have a function that takes our global array, and within the function, changes a value in one of the array’s indexes. Once outside of the function, we see our global array was changed also. We then make another function and run the .pop() method on our array and once we are out of the function, we also see that the .pop() method had affected our array outside the function! Understanding Arrays and Functions and how arrays in functions behave is a key part of your programming journey. Make sure to understand how arrays and functions behave with each other by practicing this regularly!