Javascript: Data type and variables

Data types are concepts to be able to operate on variables.
JavaScript variables can hold Data types like Strings, numbers, arrays, and so on.

Strings
Strings are written in double quotes(” “) or single quotes(‘ ‘).

In the image below..you can use a…

Data types are concepts to be able to operate on variables.
JavaScript variables can hold Data types like Strings, numbers, arrays, and so on.

Strings
Strings are written in double quotes(” “) or single quotes(‘ ‘).
Alt Text

In the image below..you can use a double quote and single quote interchangeably or when using two double quotes or a single quote in a sentence, a backslash can be used in front.
Alt Text

Number
For the number data type, It is either a negative or a positive number. It can also be a decimal number.
Alt Text

Booleans
In boolean, It is either true or false, Yes or no, off or on.
Alt Text

Arrays
It is used to store a list of data. Arrays are written using square brackets [ ].
Alt Text
An array can be written inside another array.Arrays can be accessed by their index. Every array has an index that starts with 0.

Alt Text

Objects
The object is a data type that allows the storage of collections of data. They are denoted using square brackets { }.
Alt Text

To access the data of an object: ObjectName.keyName
Alt Text

Undefined
If a variable has been declared but has not been assigned a value, has the value undefined.
Alt Text


Print Share Comment Cite Upload Translate
APA
TemitopeAgbaje | Sciencx (2024-03-29T13:04:13+00:00) » Javascript: Data type and variables. Retrieved from https://www.scien.cx/2021/03/18/javascript-data-type-and-variables/.
MLA
" » Javascript: Data type and variables." TemitopeAgbaje | Sciencx - Thursday March 18, 2021, https://www.scien.cx/2021/03/18/javascript-data-type-and-variables/
HARVARD
TemitopeAgbaje | Sciencx Thursday March 18, 2021 » Javascript: Data type and variables., viewed 2024-03-29T13:04:13+00:00,<https://www.scien.cx/2021/03/18/javascript-data-type-and-variables/>
VANCOUVER
TemitopeAgbaje | Sciencx - » Javascript: Data type and variables. [Internet]. [Accessed 2024-03-29T13:04:13+00:00]. Available from: https://www.scien.cx/2021/03/18/javascript-data-type-and-variables/
CHICAGO
" » Javascript: Data type and variables." TemitopeAgbaje | Sciencx - Accessed 2024-03-29T13:04:13+00:00. https://www.scien.cx/2021/03/18/javascript-data-type-and-variables/
IEEE
" » Javascript: Data type and variables." TemitopeAgbaje | Sciencx [Online]. Available: https://www.scien.cx/2021/03/18/javascript-data-type-and-variables/. [Accessed: 2024-03-29T13:04:13+00:00]
rf:citation
» Javascript: Data type and variables | TemitopeAgbaje | Sciencx | https://www.scien.cx/2021/03/18/javascript-data-type-and-variables/ | 2024-03-29T13:04:13+00:00
https://github.com/addpipe/simple-recorderjs-demo