1.Primitive type :
- String: A series of characters. Strings can be declared in two ways, using string template (double quotes) and String Constructor. In the given example,firstString is declared using string template and secondString is declared using String constructor.
- Number: Numbers limit from -(253 − 1) and 253–1 like -1,-2,-3,0,0.5 etc.Numbers can be fractional,negative,posive or exponential.
- Boolean: Boolean represents either true or false. It is mostly used for testing if any condition is true or false.
- Null: null is a variable that does not have any value.
- Undefined: A variable that is not assigned to any value or not declared at all.
- Symbol: After creating a symbol, its value is kept private and for internal use.
- Object: Objects are used to store properties( named value) and methods(functions that use those properties).In the given example,person is an object. It has name,number and color properties and a method(function of an object) named sayApple which returns a string.
- Function: Functions are created to perform a particular task when it is called or invoked. Here addItems is a function that has two arguments Item1, Item2, and return(Item1+Item2). When it is called after passing two arguments it will add those arguments and return the result.