JavaScript Data type & Structure
Tags: javascript, webdev, beginners, programming
Published: 2022-04-21 09:05:47

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](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/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](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/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](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/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](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/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](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/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](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/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](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/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](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/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](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Functions)

## 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](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt)

---

So, these are some of the JavaScript data types and their details.