What are JavaScript Data Types?
-
see this: symfony-world.blogspot.com/2013/07/javascript-datatypes.htmlducin– ducin2013-10-23 19:35:48 +00:00Commented Oct 23, 2013 at 19:35
-
This JavaScript data types and data structures video might be helpful.Mahmoud– Mahmoud2020-06-01 21:37:49 +00:00Commented Jun 1, 2020 at 21:37
3 Answers
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.
11 Comments
alert( typeof function(){} ) vs alert( typeof {} )There are five primitive data types in JavaScript:
- number
- string
- boolean
- undefined
- null
Everything that is not a primitive is an object.
1 Comment
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