Secret Message project, JavaScript arrays

Hello, In the project “Secret Message” I get a slightly different output. The link if the project is:
https://www.codecademy.com/paths/create-video-games-with-phaser/tracks/game-dev-learn-javascript-arrays-and-loops/modules/game-dev-learn-javascript-arrays/projects/secret-message

This is my code:

let secretMessage = ['Learning', 'is', 'not', 'about', 'what', 'you', 'get', 'easily', 'the', 'first', 'time,', 'it', 'is', 'about', 'what', 'you', 'can', 'figure', 'out.', '-2015,', 'Chris', 'Pine,', 'Learn', 'JavaScript'];
console.log(secretMessage.length);
secretMessage.pop();
console.log(secretMessage.length);
secretMessage.push('to', 'program');
secretMessage[secretMessage.indexOf('easily')] = 'right';
secretMessage.shift();
secretMessage.unshift('Programming');
secretMessage.splice(secretMessage.indexOf('get'), secretMessage.indexOf('time'), 'know');
console.log(secretMessage.join(' '));

This is the output

Programming is not about what you know get right the first time, it is about what you can figure out. -2015, Chris Pine, Learn to program

It should be this tho

Programming is not about what you know, it is about what you can figure out. -2015, Chris Pine, Learn to Program

That looks mostly right, the two that I caught were as follows. I have included what was asked as comment so you could see and then method below.

Access the array by index value here.

//Change the word easily to the word right by accessing the index and replacing it.
secretMessage[7] = 'right' ;

Use splice method on this one.

//Use an array method to remove the strings get, right, the, first, time,, and replace them with the single string know,.
//array.splice(indexToStart, numberOfIndices, 'stringToAdd');
secretMessage.splice(6,5,'know') ;
1 Like

Thanks for your help

Hi Guys,

Here is my version to the solution of the project.

let secretMessage = ['Learning', 'is', 'not', 'about', 'what', 'you', 'get', 'easily', 'the', 'first', 'time,', 'it', 'is', 'about', 'what', 'you', 'can', 'figure', 'out.', '-2015,', 'Chris', 'Pine,', 'Learn', 'JavaScript'];

secretMessage.pop();
secretMessage.push('to', 'program');
secretMessage[7] = 'right';
secretMessage.shift();
secretMessage.unshift('Programming');
secretMessage.slice(6, 11);
secretMessage.splice(6, 5, 'know');

//console.log(secretMessage.indexOf('get'));
console.log(secretMessage.join(' '));

my version

let secretMessage = ['Learning', 'is', 'not', 'about', 'what', 'you', 'get', 'easily', 'the', 'first', 'time,', 'it', 'is', 'about', 'what', 'you', 'can', 'figure', 'out.', '-2015,', 'Chris', 'Pine,', 'Learn', 'JavaScript'];

secretMessage.splice(6, 5, 'know,')
secretMessage[0] = 'Programming'
secretMessage.pop()
secretMessage.push('to Program')
console.log(secretMessage.join(' '))