DATA TYPES
PRIMITIVE IMMUTABLE
NON PRIMITIVE MUTABLE
COMPOSITE COMBINATION OF PRIMITIVE & OTHER DATA TYPES
TRIVIAL PRE DEFINED VALUES
JS DATA TYPES
Java script data types are classified into following three types
1. PRIMITIVE NUMBER, STRING, BOOLEAN
2. TRIVIAL NULL, UNDEFINED
3. COMPOSITE OBJECT, ARRAY
Number
Integer, Float, NaN
String
Declared with single or double quotation
var a = " i am ok" // i am ok
var b = "i 'm ok" // i'm ok
var c = ' "guvi" ' // "guvi"
var d = "i am in \"the\" game" // i am in "the" game
var e = "i am in \' the game" // i am in 'the game
Boolean
True or False
Boolean (0) ('')(null)(undefined) = false
Boolean (0.1) (' ') = true
Undefined
var a; (without any value)
Null
var a = null
Array [ ]
Helps to store list of data (it allow mixed data types also).
Index starts from Zero and length starts from the count 1
It consists only numbered index.
Object { }
Named Index array (instead of [ ] declared inside { })
Number
String
Boolean
Undefined
Function
Object --> Object, Array, Null
typeof(1) - number
typeof(1.1) - number
typeof("1.1") - String
typeof("JS") - String
typeof(true) - Boolean
typeof(null) - Object
typeof(undefined) - undefined
typeof([]) - object
typeof({}) - Object
typeof(NaN) - number
Comments
Post a Comment