How to have the real apostrophe ( ' ) in a sentence in a JavaScript print please?

Hello, how to have the real apostrophe (’) in a sentence in a JavaScript please?
For example, I’m trying to write: Welcome to Chanty’s Creations. But it’s not printing it full.
I tried to combine the sentence with + but still no printing for the apostrophe itself.
Thank you in advance.

If you open a string using ’ then it will take the next instance of ’ as the end of the string.

To get around this you can also open a string with ". This will mean you ’ will be ignored. You then close the string with ".

So your example "Welcome to Chanty's Creations."

2 Likes

Thank you so much winningblue

2 Likes

You can also use \ to escape the ', like so:

console.log('\'');
3 Likes

I was just going to say. I was using " but then i realised, it is just faster to type /’ like:

console.log('It\‘s winter! Everything is covered in snow.’)