JavaScript curly braces with no function or json -


just opened client's javascript file , first lines along lines of this:

{     var s_account="blog"; } 

which don't get. normally, in experience, curly braces wrap around function...

function welcome(){ ... 

...or json javascript object

var attributes = { : "that... 

can tell me why there curly braces no text before them or after them? / point of it?

can tell me why there curly braces no text before them or after them? / point of it?

there no significant point them in javascript. act same if code

var  s_account="blog"; 
speculation

in other languages have block scope, might restrict scope of variable, since js doesn't have feature (for better or worse), braces without control structure or function meaningless , ignored.

most code left on deleted function or if statement however. not pattern copied.


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

jquery - How would i go about shortening this code? And to cancel the previous click on click of new section? -