Secret Message Project - Help!


#1

Hey, can anyone help me with this exercise?
I’m doing the Secret Message Exercise Project from the JavaScript course, but I’m getting a bit confused to why this isn’t it working.

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.pop());
console.log(secretMessage.lenght);

It should have given me the array without ‘JavaScript’, but all I get is “undefined”.
Many thanks in advance! :slight_smile:


#2

.pop() returns the removed element

undefined is also what you get when calling a non-existing method:

console.log(secretMessage.nonExistingMethod);

#3

As to why your pop method isn’t working, I don’t know. I just pasted your code into my editor and ‘JavaScript’ printed to my console.

But .length property is misspelled. That will give you “undefined”.