How to write apostrophes in strings?

Hi, I’ve got a very basic problem: I can’t console.log any string including ’ sign as that’s read as a part of the code instead of a grammar syntax.
for example
console.log(‘This is Jason’s brother.’);
will display as an error.
Any advice how should I write apostrophes in the strings? Thanks a lot.

Hi there,

There are a few ways to accomplish this. First, you can use the character code which is '

console.log('This is Jason's brother')

You can simply put a \ in front of the ’

console.log('This is Jason\'s brother')

Or you can use ` or " instead of ’

console.log(`This is Jason's brother`)
console.log("This is Jason's brother")

Hope this helps!


Thanks so much! This was very helpful and informative!