toUpperString() function not working

hi guys, I’m currently working on The Odin Project, and one of the exercises asked me to create a function capitalize().

Here is the code:

function capitalize(str) { return str.toUpperCase(); }

When i tried executing the function on browser console, for example


this error comes up:

VM529:1 Uncaught ReferenceError: hello is not defined
at :1:12

I’m not sure why whatever parameter I put in, it says that the parameter is not defined.

I’m expecting the parameter, in this case: hello, to result in “HELLO”

Please help

You haven’t included quote marks around hello, so you’re trying to capitalise a non-existent variable, not a string.

1 Like

Hi there! Hello must be a string, not variable here

hi, thank you so much! so without the quote marks “”, it didn’t recognize the parameter as a string ?

thank you for answering! just to be clear, without the quote, it doesn’t get recognized as a string ? so what is the type ?

That’s right. Without quotation marks your hello is treated as a variable

i see… thank you so much!

1 Like