put a varible inside quotes

This forum contains topics that were moved from Get Satisfaction
Mark7294305
Posts: 0
Joined: Fri Dec 26, 2014 2:10 am

put a varible inside quotes

Post 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

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

put a varible inside quotes

Post 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

Post Reply