Yves
Yves

Reputation: 12507

What are JavaScript Data Types?

What are JavaScript Data Types?

Upvotes: 30

Views: 19027

Answers (3)

csusbdt
csusbdt

Reputation: 96

Javascript has a typeof operator that returns a string that names the datatype of its argument. So, you could say that the datatypes in Javascript are all the possible return values of this operator. Look here:

https://developer.mozilla.org/en/JavaScript/Reference/Operators/typeof

Upvotes: 2

Srikar Doddi
Srikar Doddi

Reputation: 15599

There are five primitive data types in JavaScript:

  1. number
  2. string
  3. boolean
  4. undefined
  5. null

Everything that is not a primitive is an object.

Upvotes: 17

Magnar
Magnar

Reputation: 28810

There's

  • Numbers
  • Strings
  • Booleans
  • Objects
  • null
  • undefined

Note that there isn't a separate Integer, just number - which is represented as a double precision floating point number.

There's also

  • Functions
  • Arrays
  • RegExps

all of which are Objects deep down, but with enough special wiring to be mentioned on their own.

Upvotes: 25

Related Questions