Data Types
A variable in JavaScript can contain any data.
It is possible to assign a string to a variable initially and then reassign the variable to a number.
A programming language that has this capability is called 'Dynamically Typed'
Data Type | Value or Reference | Comments |
string | Value Type | is Immutable and cannot be changed once they have been created |
number | Value Type | is Immutable and cannot be changed once they have been created (float) Prone to rounding errors |
bigint | Value Type | |
boolean | Value Type | |
symbol | Value Type | Added in ES 2015 |
null | Value Type | |
undefined | Value Type | |
object | Reference Type | is Mutable and can be changed once it has been created |
function | Reference Type | is Mutable and can be changed once it has been created |
function Data Type
A 'function' data type is a special type of object.
typeof function() {} // "function"
typeof new Function // "function"
array Data Type
An 'array' data type is a special type of object.
It does have some additional properties and functions that a normal object does not have.
typeof myArray // "object"
null evaluates to False in a boolean expression
undefined evaluates to False in a boolean expression
primitive data types are equal if the values match
© 2023 Better Solutions Limited. All Rights Reserved. © 2023 Better Solutions Limited TopPrevNext