• JS Keywords/Reserve Words :

    • These words cannot be used as JavaScript variables, functions, methods, loop labels, or any object names by the programmers in their programs.
    • A list of all the reserved words in JavaScript are –

abstract, boolean, break, byte, case, catch, char, class, const, continue, debugger, default, delete, do, double, else, enum, export, extends, false, final, finally, float, for, function, goto, if, implements, import, in, Instanceof, int, interface, long, native, new, null, package, private, protected, public, return, short, static, super, switch, synchronized, this, throw, throws, transient, true, try, typeof, var, void, volatile, while, with.

  • JS Data Type :

    • Data types are very important in Java script(JS) because JS has rich data type and provides different data types to hold different data values easily.
    • Dynamic Data Type:
      • Datatypes in JavaScript is of dynamic nature i.e. the nature of variable depends on the value assigned into it or same variable can be used to hold different data types.
      • JavaScript is a dynamic type language, i.e. we don’t need to specify the data type of the variable initially because it is dynamically configured by JavaScript engine automatically.
      • The var/let keyword is used to specify the dynamic data type.
      • Dynamic data type can hold any data type values.
      • For example:
        var a=40; // Here a stores numeric values hence a is number type.  
        var b=“India”; //Here b stores string values hence b is string type.  
    • Broadly the Java Script datatype is divided into two data types – 

(A) Primitive data type and (B) Non-primitive (reference) data type

(A) Primitive Data Type

There are five types of primitive data types in JavaScript:-

(A) Number

      • The number data type holds any type of number, either an integer value or a real/float number. 
      • Examples : 
let x;
x=10;
x=12.32;
x = 123e5;      // 12300000
let x = 123e-5;     // 0.00123
(B) BigInt
      • This data type represents whole numbers larger than 2^53 – 1, which is the largest number that can be represented by the Number data type.

(C) String

      • A string is a collection of a sequence of characters i.e. letters, digits, punctuation characters, symbols, or a combination of all these. 
      • Strings are declared within single or double quotes.
      • Examples : 
let x;
x=”India”;
x=’India’;
x=”200″;
let y=”India”;

(D) Boolean

      • A boolean variable can store only two possible values either true or false.
      • This data type represents a logical entity that can have one of two values: true or false.
      • Internally it is stored as 1 for true and 0 for false.

(E) Undefined

      • This data type represents a variable that has been declared/used in the program but not exists or a variable that does not assign a value or a property that does not exist.

(F) Null

      • This data type represents an intentional absence of any object value.
      • JavaScript supports a special data type known as null that indicates ‘no value at all or blank but may be in future’.
      • Null is not equal to 0 or empty.
      • For example :
        • var x= new object();
          x= null;

(G) Symbol

      • This data type represents a unique identifier.
(B) Non-Primitive Data Type

(a) Object

      • An object is a collection of properties, where each property has a name and a value.
      • Objects can contain any type of data, including other objects.
      • All variables in JavaScript are considered as object data types.

(b) Array

      • An ordered collection of values, accessed by their index.

(c) RegExp

      • This data type represents a regular expression.

Loading


0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.