function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
nitsnits 

Not able to work on data types..

1) var oc= '{!TestScreen__c.Occupancy__c}';
alert(oc);
2) var oc= {!TestScreen__c.Occupancy__c};
alert(oc);
 
Statement 2) gives error. I am not able to find the error.
ckempckemp
The error is that, basically, stuff within the {! [...] } is replaced with values before the Javascript is run by your browser, more or less.  So to your browser, #1 looks like "var oc = 'my substituted value';" (correct) and #2 looks like "var oc = my substituted value;" (incorrect, will generate an error.)
AkiTAkiT
Quotes are missing in the #2.