-4

I am really new to Javascript and this might be a really dumb question but how do you type an apostrophe in between an object?

const data = {

greeting: 'Welcome to John's restaurant'
}

Do I need to write something in front of it? Thank you in advance

Sinto
  • 3,915
  • 11
  • 36
  • 70
TheAlphaKarp
  • 159
  • 2
  • 13
  • You can use '\'. So your string sould be 'Welcome to John\'s restaurant' – Mehmet Ince Sep 13 '18 at 13:06
  • [String literals.](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#String_literals) If you don't have any other language guide or tutorial available, the MDN site is a pretty good resource. (But you should have a guide or tutorial already.) – Pointy Sep 13 '18 at 13:07

1 Answers1

1

Use \ before the ':

const data = {
greeting: 'Welcome to John\'s restaurant'
}
protoproto
  • 2,081
  • 1
  • 13
  • 13