Javascript basics quiz

I Can’t get what is the mistake can u crt me

1 Like

Hi, The trim() method in JavaScript returns a new string with leading and trailing whitespace removed. However, in your code snippet, you are not reassigning the result of mStr.trim() to any variable.

When you call mStr.trim(), it trims the whitespace from the original string, but you are not capturing the result in any variable. Therefore, when you call console.log(mStr), it prints the original value of mStr, which is " Hello World ", and one more important thing it will only remove whitespace not change string nature so hello world will not print like second option so close it will print like same way how the js normal strings behave like first option!!

1 Like

OK Thankyou mam .i’m clear now.

1 Like