🧐🤓Data types and values in Javascript 💻
Tags: javascript, node, webdev, beginners
Published: 2020-04-26 18:16:47

---
title:🧐🤓Data types and values in Javascript 💻
published: true
description: The data type is a property of a value that determines the values it can take, what types of operations we can perform on it and how its internal representation.
tags: #Javascript, #Node, #webdev, #beginners
---


The data type is a property of a value that determines the values it can take, what types of operations we can perform on it and how its internal representation.
In JavaScript we find different types of values and data types to store in variables.

**Values and types**
*Main (primitive) types*
> _string number boolean_

**Composite type**

> Object
>  Array

**Special type**

> _Null_
> _Undefined_

In the case of ES6, a new type of this denomination type is presented as a   `symbol`  data type whose values are unique and cannot be changed.

JavaScript provides an operator called `typeof`, this operator can examine a value and tell it what type it is:

![Typeof image](https://dev-to-uploads.s3.amazonaws.com/i/099ibd8ua0yque2m2ph5.png)

This operator is special since it allows us to know the type (number, boolean, undefined, object) that the variable has on which we are going to perform an action.

#✨ String
A string value is a set of Unicode characters (letters, digits, punctuation, and more), this data type is responsible for rendering the text in JavaScript

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/io11rb4kgq6sm83jj4uf.png)

#💡 Number
In JavaScript, no distinction is made between integer and floating point values; a JavaScript number can be any one of them (internally, JavaScript represents all numbers as floating point values).

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/6iedn86yec8o2h0s515e.png)

#💡 Boolean
This data type stores 1 bit can be true or false, they are used to record a state (TRUE OR FALSE)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/iu7lu9xhp8tu12bunqzc.png)

#💡 Objects
Since JavaScript is designed in an object-based paradigm. We say that an object is a collection of properties, these objects can be compared to tangible objects in real life.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/mggfzibewoqs5iqfnq28.png)

Another way to access the properties of these objects is as follows:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/5wfwn7ab8ygmh5993dx9.png)

Access (by index) an Array element
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/z8waeb2d6n6nxzkfcz36.png)
Now if we think about the name of position [1], it should be Mariano, well, when starting to program this may sound a bit strange, but in programming we start counting from the number zero (0).

#💡 Undefined
This data type is used when we do not know the content of a variable or it has not yet been defined.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/kh6b4pk2sz7r84wdxij7.png)

#💡 Null

The `null`data type has only the `null` value. Null reserved keyword cannot be used as a function or variable name
A variable containing `null`does not contain any type of boolean number, string or value, nor an array or object. This data type is not 0 like in other languages like C or C ++, declaring a variable of type null and using the operator typeof it interprets the value as Object not as null type

Thanks for reading 💻
🤓 You can follow me on Twitter or find me on GitHub by visiting my website
https://about.me/franciscoimanol