Having problems with the JavaScript built-in methods


#1

Ok, so I am doing this exercise where I have to use the JavaScript documentation to remove the white space on a string, I went and looked for the method and copied it exactly as it was inside the parenthesis of the console.log (as you can see in the screenshots) and the console told me there was an error "Cannot read property ‘prototype’ of undefined
at Object."
Help please?
Thank youuuu


#2

Here is the method as it was written on the JavaScript documentation:


#3

There are examples in that documentation of how to use trim


#4

i solved it, thanks, i am not very good in english :slight_smile:


#5

I cannot solve the issue but I am sure I am using the right code, I checked the moz doc, here is the code I am trying to use:

console.log(' Remove whitespace '.trim());

#6

I have exactly the same problem


#7

You’ve changed other things on that line of code aside from just adding what the instructions told you to. If you change anything else it throws off the system. Use the reset button at the bottom of the window to reset the exercise, then only add the .trim() after the quoted text on that line. What you have done would technically work outside this strict example, but since you changed the number of spaces and the type of quotation mark from a single to a double, it’s not matching what the system expects.


#8

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.