Have used to Bind Login User name from portal to a Javascript variable. User name contains either SingleQuote or DiubleQuote sometimes.
My Javascript code failed to read string with DiubleQuote.
EX:
var userName = "Happy and "Care" Ltd"; - error: unknown: Unexpected token, expected ";" var userName1 = 'Happy and Care's Ltd'; - error: unknown: Unexpected token, expected ";"
You can use backticks `` like this :
var userName = `Happy and "Care" Ltd`; var userName1 = `Happy and Care's Ltd`; console.log(userName) console.log(userName1)
2.1m questions
2.1m answers
60 comments
56.9k users