Javascript types

There are many types (data types) or values in javascript. after the latest release of ES6 , another two data types have been included in the list. today we will be aquainted with them all together.

Javascript values are basically two types. which are:
1. Primitive Values
2. Objects and functions

  1. Primitive values:
    Primitive values are those things which can’t be manipulated inside the code once declared. There are many examples of primitive values among which, strings and numbers are the prominent.

Some other primitive values are:

*Undefined​ (undefined), used for unintentionally missing values.
* Null​ (null), used for intentionally missing values.
* Booleans​ (true and false), used for logical operations.
* Numbers​ (-100, 3.14, and others), used for math calculations.
* Strings​ (“hello”, “abracadabra”, and others), used for text.
* Symbols​ (uncommon), used to hide implementation details.
* BigInts​ (uncommon and new), used for math on big numbers.

2. Objects and functions:
Objects are functions are not primitive types i.e. they can be manipulated inside the code. They can take other values and to operations on them. In javascript , arrays are also an object type.

Now that we have some fundamental knowledge about the types, let us enquire about how we can know about the type of a certain data? Fortunately, we have a function named TypeOf() in javascript, which does the trick easily. Check out the following code:

So, we can see that, typeOf gives us the types of each values. So, thats all for today, see you around!!! ❤



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
imdadul ahmed

imdadul ahmed

Seeking a challenging yet rewarding career with a progressive organization that provides the opportunity for development.