Variables are nothing but named containers. you can place information into these containers after which consult with the records using the name of its container.
In the following CoffeeScript code, we've defined variables name and age, of string and number data types respectively. Store it in a document with the name variable_example.coffee.
Bring together the above CoffeeScript code by using executing the following command inside the command spark off.
in the above example, we have created a variable named I within the global space and assigned the price 10 to it. And within the function, in an attempt to create a nearby variable with the identical name, we've got declared as i=20; without var keyword. Since we neglected the var keyword, the value of the global variable i is reassigned to 20.
For this reason, it is recommended to declare variables using the var keyword.
Anyway, if we want, we can declare a variable with global namespace. We can do it explicitly as shown below.
At the same time as naming your variables in CoffeeScript, hold the subsequent guidelines in mind.
You need to no longer use any of the CoffeeScript reserved keywords as a variable name. Those keywords are cited in the next phase. As an instance, break or Boolean variable names are not legitimate.
CoffeeScript variable names should not start with a numeral (0-nine). They should begin with a letter or an underscore character. For instance, 123test is an invalid variable name; however, _123test is a valid one.
CoffeeScript variable names are case-sensitive. as an instance, call and name are distinctive variables.
CoffeeScript Related Interview Questions
|XML Interview Questions||HTML Interview Questions|
|HTML 5 Interview Questions||Oracle DBA Interview Questions|
|HTML DOM Interview Questions||Java Interview Questions|
|JBOSS Interview Questions||Java XML Interview Questions|
|ebXML Interview Questions||Unix/Linux Interview Questions|
|Xml Publisher Interview Questions|
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.