Types of Data in JavaScript?



Hello Everyone in this post I am going to tell you all about Data members in JavaSript and what are the data type it does not support? Please see these below:

We all have different type information(data) in our life like our name as string our age as number. JavaScript only have three most basic types of data and they are number, string and Boolean.

String:
In a simple words string is a set of character or sequence of character e.g. “Hello Everyone” is a string. Opening quote tells JavaScript interpreter that content after opening quote is string(just series of symbol/character) interpreter accepts these symbols and without trying to interpret it. When the interpreter finally encounters with closing quote mark it understands that it has reached the end of the string and continues with rest of the script. You can use either double quote marks (“Hello Everyone”) or single quote marks (‘Hello Everyone’) for the string, but have to use the same type of quote mark at the start and end of the string.

Number:s
Numbers are used for mathematical calculation or for counting Number plays a very important role in JavaScript deciding that which loop will run for how much number of times. e.g. 12 or 24.3333333 is a JavaScript number. JavaScript allows us to use negative numbers, like –50 or -159.356. By using these we can perform various mathematical operation.

NOTE: document.write(10 + 2); will prints the total as (12) but document.write(“10” + “2”) will print 102 because the number in quote will be considered as string and after adding these two string will result as 102.

Boolean:
Boolean are very simple variable they could be either true or false. There are some question whose solution can be either true or false like in a simple login form weather the password is correct(true) or incorrect(false). Boolean value are very use in adding logic to the Script.

Stay tuned for the PHP Magento, WordPress, JavaScript and Magento2 latest tutorial and updates, Hope you enjoyed reading, if you need the professional Magento Development / PHP we can help you, just Click on the Link and send me your requirements.

Please Like the Post on Facebook or Google+.