Reputation: 2052
is there a suppress escape chars in Javascript similar to the @ in C# ? I have to assemble a sting like below - however Im having problems with the multi-line layout and some of the characters in the string. How would one concatenate such a string in Javascript?
my attempt to concatenate my string in JAVASCRIPT:
var idfTEXT_ROOM = "
! " + this.Name +"
! -------------
Zone,
" + this.Name + ", !- Name
" + this.DirRelNorth + ", !- Direction of Relative North {deg}
0, !- X Origin {m}
0, !- Y Origin {m}
0, !- Z Origin {m}
1, !- Type
...
Of course like that it throws an "Uncaught SyntaxError: Unexpected string" error.
Upvotes: 0
Views: 2339
Reputation: 1422
For multiline strings here are different options for you.
Im always using this method:
'Hello Javascript' +
'world' +
'!!!' +
...
Upvotes: 3