Home > OS >  is there any error solving for javascript object to converting it into string
is there any error solving for javascript object to converting it into string

Time:03-27

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

CodePudding user response:

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.

CodePudding user response:

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!

  • Related