At first what is JavaScript?
JavaScript is programming language or specifically a scripting language which enables to create dynamically updating content, control multimedia, animated images and pretty much everything ๐
There are ten types of data types in JavaScript. They are:
- String,
- Integer,
- Float,
- Boolean,
- Undefined,
- Null,
- Object,
- Array,
- Function.
- BigInt
String
Strings in JavaScript are sequences of Unicode characters or specifically sequences of UTF-16 code units. Strings in JavaScript declared in single quotation mark ('') or double quotation mark (""). Example:
var string = 'ASCII text';
There is a detailed description about JavaScript string in this link: MDN JavaScript String
Integer
Integer is a number type in JavaScript. Which is a 64 bit binary format value. Like example:
var integer = 123456789;
There is a detailed description about JavaScript integer in this link: MDN JavaScript Number
Float
Float is another number type data-type in JavaScript. Float is a type of data that refers to decimal value with points. Like:
var float = 123.456;
There is a detailed description about JavaScript float in this link: MDN JavaScript Number
Boolean
Boolean is a type, with two possible values. Either true or false. Example:
var YES = new Boolean (true);
if (typeof variable === "boolean"){console.log("variable is a boolean");}`
There is a detailed description about JavaScript Boolean in this link: JavaScript Boolean
Undefined
Undefined is a variable which has been declared, but no value has been given to itย .
var undef;//defaults to undefined
var undef = undefined;//not common, use null
There is a detailed description about JavaScript Undefined in this link: JavaScript Undefined
Null
Null is a value that can be assigned to a variable and represents 'no value'.
var nul = null;
There is a detailed description about JavaScript Null in this link: JavaScript Null
Object
JavaScript object is a collection of name-value pairs. Likeย ;
var person = {'name':'John Smith','age':27};
There is a detailed description about JavaScript Object in this link: JavaScript Object
Array
Arrays in JavaScript are actually a special type of object. It's like a regular objects declared in [] syntax. But it has one magic property which is length.
var arr = ['Hello','my','name','is','Dr.Hippo',123,null];
There is a detailed description about JavaScript Array in this link: JavaScript Array
Function
JavaScript function is a procedure. In function by taking one or more input then there will be some steps and then the output will be result.
var fun = function(){
return 42;
}
There is a detailed description about JavaScript Funtion in this link: JavaScript Function
BigInt
JavaScript BigInt is a numeric data type that can represent integers in the arbitrary precision format.
var alsoHuge = BigInt(9007199254740991); // 9007199254740991n
There is a detailed description about JavaScript BigInt in this link: JavaScript BigInt
So, these are some of the JavaScript data types and their details.
Top comments (0)