skip to Main Content

enter image description hereI am learning javascript where I get this error when I convert a object of js into a string it says semicolon required

2

Answers


  1. You might want to check a tutorial for the basic syntax.

    There you are settings everything between ' that can only be used for one line strings. That is probably not what you are trying to do.

    If you really want a multiline string, you can use the backticks. Or you can have a normal object and use JSON.stringify to turn it into a string.

    Login or Signup to reply.
  2. When using single or double quotes, you can only do strings on one line, 2 possible solutions is using JSON.Stringify or backticks. Using backticks allows multiline strings and JSON.Stringify will convert everything to a string too!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search