Datatype in  one shot

Datatype in one shot

  1. Number:

     let num =10
     console.log(typeof num); // Output: "number"
    

    Definition: Represents numeric data, including both integers and floating-point numbers.

  2. String:

     let  str = "Hello, World!";
     console.log(typeof str); // Output: "string"
    

    Definition: Represents a sequence of characters, enclosed within single quotes ('') or double quotes ("").

  3. Boolean:

     let isTrue = true;
     console.log(typeof isTrue); // Output: "boolean"
    

    Definition: Represents a logical value, either true or false, used for logical operations and conditions.

  4. Undefined:

     let undefinedVar;
     console.log(typeof undefinedVar); // Output: "undefined"
    

    Definition: Represents a variable that has been declared but has not been assigned a value.

  5. Null:

     let nullVar = null;
     console.log(typeof nullVar); // Output: "object"
    

    Definition: Represents the intentional absence of any object value. It is often used to signify a deliberate non-existence or invalid reference.

  6. Symbol:

     let= Symbol('foo');
     console.log(typeof sym); // Output: "symbol"
    

    Definition: Represents a unique and immutable data type used to identify object properties. Symbols are often used as keys in JavaScript objects to avoid naming conflicts.

  7. Object:

     let= { key: 'value' };
     console.log(typeof obj); // Output: "object"
    

    Definition: Represents a collection of key-value pairs, where keys are strings (or Symbols) and values can be of any data type, including other objects.