Sobes.tech
Intern

What data types exist in JavaScript?

sobes.tech AI

Answer from AI

JavaScript has eight data types:

  1. Primitive Types:

    • string: String value.
    • number: Numeric value (integers and floating-point numbers).
    • bigint: Arbitrary-precision integers.
    • boolean: Logical value (true or false).
    • symbol: Unique and immutable primitive value, often used for unique property identifiers.
    • null: Special value representing the absence of any object value.
    • undefined: Value assigned to variables that have not been assigned a value, or the result of accessing a non-existent property of an object.
  2. Object Type:

    • object: Complex type including objects, arrays, functions, and other data structures.

The key difference between primitive and object types in JavaScript is that primitive types are passed by value, while objects are passed by reference.