DataTypes and Scope In JavaScript - Sagar Jaybhay

DataTypes and Scope In [JavaScript ]

JavaScript is the most popular language In the world and it runs on the most popular environment means web(browser); By using JavaScript you can create complete web and desktop application.

[DataTypes in Javascript:]

In JavaScript, there are 3 types of primitive data-types.

  1. Number

  2. String

  3. Boolean

  4. Number : in this, you can assign values like 10,10.2 means even if you assign a floating-point number to a variable it is treated like a number data-types.

  5. String : in this, you can assign a single character or multiple characters it is treated as string datatype.

  6. Boolean : You can assign true and false value in this.

  7. Undefined : in this, you declared a variable but you don’t assign the value to it is undefined.

  8. Null : if a variable can not contain value other than null it is null.

1 Like

Great work, good examples and it’s good to see auto global scope mentioned, is usually forgotten.

Some things to point out:

  • There is a typo on “there are 3 primitive types” even though you have 5 listed right below.

  • The primitive data type symbol is not mentioned even though it’s a primitive data type in JavaScript.

  • Would be also cool to see block scope since you mention lexical scope.

Keep the articles going ^^

1 Like