Page 1 of 1

put a varible inside quotes

Posted: Tue May 15, 2018 6:47 pm
by Mark7294305

Hello Support
Could you please help me. I am trying to put a varible inside quotes as follows

var number = "1000";

"status": ' + number + ' ,

however the above fails. Could you help me with the correct syntax?

I need to the result to be

"status": "1000"

Thanks

Mark


put a varible inside quotes

Posted: Tue May 15, 2018 7:16 pm
by Bruce Stuart

var sNumber = "1000" ;
var sStatusWords = ' " status" : " ' + sNumber + ' " ' ;
console.log( sStatusWords ) ;

the word 'Number' and it's variants - are close to or 'are' reserved words - be careful.

We use:

s To prefix any string variable
n to prefix any number
d to prefix any date
b to prefix any boolean

etc.

Best,

Bruce