Please explain to me the importance of the final line of code "editInPlace()". What is happening? If I delete it, the reassignment doesn't work, why?

Tell us what’s happening:

Your code so far

const s = [5, 7, 2];
function editInPlace() {
'use strict';
// Only change code below this line

// Using s = [2, 5, 7] would be invalid
s[0]=2; s[1]=5; s[2]=7;
// Only change code above this line


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36.

Challenge: Mutate an Array Declared with const

Link to the challenge:

This line here invoke (“fire”) the function; without it the function will not run and the array will remain unchanged.

Hope it helps :slight_smile:



Maybe you just missed it?

If not, I’m a little confused about how you have gotten to the ES6 part of the curriculum without knowing what a function invocation looks like.

You can review this challenge again if needed

I know this was answered already, but still.

// function definition
function functionName() {
  console.log("Hello World");
// function invocation

A function definition does nothing on its own, you have to call (invoke) the function. Code inside a function only runs after the function has been called.

1 Like