

{"id":62424,"date":"2019-08-01T11:43:09","date_gmt":"2019-08-01T06:13:09","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=62424"},"modified":"2021-02-17T21:32:32","modified_gmt":"2021-02-17T16:02:32","slug":"javascript-data-types","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/javascript-data-types\/","title":{"rendered":"JavaScript Data Types &#8211; Grab complete knowledge about Data Types!"},"content":{"rendered":"<p>The <em>data types in JavaScript<\/em> looks simple and useless but having an insight on how they work is essential. Data types help to provide a better understanding of the language and its behaviour.\u00a0<span style=\"font-weight: 400\">Today, with the help of this tutorial, we will cover one of the most important concepts that we need to learn to master JavaScript. If you are already familiar with any other programming language, you must already know some of the data types along with their use. Even if you are new to programming, don\u2019t worry, this tutorial covers it all.\u00a0<\/span><span style=\"font-weight: 400\">Like every programming language (C\/C++ and Java), JavaScript also has two basic data types. They are:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><strong>Primitive Datatypes<\/strong><\/li>\n<li style=\"font-weight: 400\"><strong>Non-primitive (reference) Datatypes<\/strong><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">Since JavaScript is a dynamic language, you don\u2019t need to specify the type of the variable. It is dynamically used by the JavaScript Engine. The <\/span><b>var<\/b><span style=\"font-weight: 400\"> keyword specifies the type of data in the variable like a <em>number, string,<\/em> etc.<\/span><\/p>\n<p><em><span style=\"font-weight: 400\"><strong>Note:<\/strong>\u00a0It is important that you read DataFlair\u2019s article on <strong><a href=\"https:\/\/data-flair.training\/blogs\/javascript-variable-tutorial\/\">JavaScript Variables<\/a><\/strong> before continuing with this one. You need a strong understanding of what variables are and how they work.<\/span><\/em><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/JavaScript-data-types.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-66563\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/JavaScript-data-types.jpg\" alt=\"JavaScript data types\" width=\"800\" height=\"420\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/JavaScript-data-types.jpg 800w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/JavaScript-data-types-150x79.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/JavaScript-data-types-300x158.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/JavaScript-data-types-768x403.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/JavaScript-data-types-520x273.jpg 520w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><\/p>\n<h2><span style=\"font-weight: 400\">JavaScript Datatypes (Primitive)<\/span><\/h2>\n<p><span style=\"font-weight: 400\">All datatypes except Objects define immutable values i.e. these values are incapable of changing. These values are <strong>\u201cprimitive values\u201d<\/strong>. JavaScript has seven types of primitive data types, based on the type of data we are storing in the variable:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Number<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">BigInt<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Boolean<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">String<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Null<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Undefined<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Symbol (new in ECMAScript 6)<\/span><\/li>\n<\/ul>\n<h3><span style=\"font-weight: 400\">1. Number<\/span><\/h3>\n<p><span style=\"font-weight: 400\">ECMAScript has two built-in numeric types: Number and BigInt.\u00a0<\/span><span style=\"font-weight: 400\">The Number type represents both integer and floating-point numbers and has 3 symbolic values:<\/span><\/p>\n<ul>\n<li><span style=\"font-weight: 400\"> +Infinity<\/span><\/li>\n<li><span style=\"font-weight: 400\"> -Infinity<\/span><\/li>\n<li><span style=\"font-weight: 400\">NaN (Not-a-Number)<\/span><\/li>\n<\/ul>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">10 \/ +0\u00a0 \/\/+Infinity\r\n10 \/ -0\u00a0 \/\/-Infinity\r\n\u201cx\u201d \/ 10\u00a0 \/\/NaN<\/pre>\n<p><span style=\"font-weight: 400\">Various operations, including arithmetic and comparison operators, are available to use for numbers. The above example shows that performing mathematical calculations is perfectly <strong>\u2018safe\u2019<\/strong> in JavaScript. The worst result you will get is NaN, but the script will never stop with a fatal error.<\/span><\/p>\n<h3><span style=\"font-weight: 400\">2. BigInt<\/span><\/h3>\n<p><span style=\"font-weight: 400\">This is a new numeric datatype in JavaScript that can represent arbitrary precision. It can safely store and operate on large integers that are beyond the safe limit for Number. We create it by appending <\/span><b>n<\/b><span style=\"font-weight: 400\"> to the end of the integer or by calling the constructor. It behaves like a Number in cases where we convert it to Boolean:<strong> if, ||, &amp;&amp;.<\/strong> We cannot operate on BigInt interchangeably with Numbers since it will throw a TypeError (an error when a value is not of the expected type).<\/span><\/p>\n<p><b>Input:<\/b><b><\/b><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">const x = 2n ** 53n;\r\n\r\n<\/pre>\n<p><b>Output:<\/b><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">9007199254740992n<\/pre>\n<h3><span style=\"font-weight: 400\">3. Boolean<\/span><\/h3>\n<p><span style=\"font-weight: 400\">The Boolean type represents a logical value that has two possible values: <b style=\"font-size: 16px\">true <\/b><span style=\"font-weight: 400\">and<\/span><b style=\"font-size: 16px\"> false<\/b><span style=\"font-weight: 400\">. These are often used in conditional statements which will be explained in later tutorials.<\/span><\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">var x = 2;\r\n\r\nvar y = 3;\r\n\r\nvar z = 3;\r\n\r\nx == y;\u00a0 \/\/ returns false\r\n\r\ny == z;\u00a0 \/\/returns true<\/pre>\n<p><span style=\"font-weight: 400\">It is clear from the above example that <\/span><b>true<\/b><span style=\"font-weight: 400\"> means \u2018the condition is correct\u2019, while <\/span><b>false<\/b><span style=\"font-weight: 400\"> means\u00a0<strong> \u2018the condition is incorrect\u2019.<\/strong><\/span><\/p>\n<h3><span style=\"font-weight: 400\">4. String<\/span><\/h3>\n<p><span style=\"font-weight: 400\">The String type represents textual data in JavaScript and is a set of <strong>&#8220;elements&#8221;<\/strong> of 16-bit unsigned integer values. Each element in the String occupies a position in the String, starting with index 0. JavaScript strings are immutable, i.e., once it is created, it is not possible to modify it. But we can create new strings based on an operation on the original <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Global_Objects\/String\">string<\/a>.\u00a0<\/span><span style=\"font-weight: 400\">We write them in quotes, either single or double.\u00a0<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">var name1 = \u2018DataFlair\u2019;\r\nvar name2 = \u201cDataFlair\u201d;\r\n\r\n<\/pre>\n<h3 class=\"EnlighterJSRAW\">5. Null<\/h3>\n<p><span style=\"font-weight: 400\">The Null datatype in JavaScript only represents\u00a0<b style=\"font-size: 16px\">null <\/b><span style=\"font-weight: 400\">value. In computer science, a <\/span><b style=\"font-size: 16px\">null<\/b><span style=\"font-weight: 400\"> value shows a reference that points to a non-existent or invalid object or address. You can consider it a bug in JavaScript such that a data type <\/span><b style=\"font-size: 16px\">null<\/b><span style=\"font-weight: 400\"> is an object, while it should be of the type <\/span><b style=\"font-size: 16px\">null<\/b><span style=\"font-weight: 400\">.<\/span><\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">var name1 = null;<\/pre>\n<p><span style=\"font-weight: 400\">Here, the variable <\/span><b>name1<\/b><span style=\"font-weight: 400\"> is an empty object. You will understand how and when to use this data type as you start solving complex problems.<\/span><\/p>\n<p><em><strong>Explore and master the concept of\u00a0<a href=\"https:\/\/data-flair.training\/blogs\/javascript-objects\/\">JavaScript Objects<\/a><\/strong><\/em><\/p>\n<h3><span style=\"font-weight: 400\">6. Undefined<\/span><\/h3>\n<p><span style=\"font-weight: 400\">The Undefined type represents a variable that doesn\u2019t have any value, even though we have declared it.\u00a0<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">var myVariable;\r\n\r\n<\/pre>\n<p><span style=\"font-weight: 400\">Since we have declared the variable <\/span><b>myVariable<\/b><span style=\"font-weight: 400\"> but without assigning any value, it is an <\/span><b>undefined<\/b><span style=\"font-weight: 400\"> variable. Normally, we use <\/span><b>undefined<\/b><span style=\"font-weight: 400\"> for checks like seeing if a variable has a value assigned.<\/span><\/p>\n<h3><span style=\"font-weight: 400\">7. Symbol (new in ECMAScript 6)<\/span><\/h3>\n<p><span style=\"font-weight: 400\">The Symbol type is a unique and immutable primitive value and may be used as the key of an Object property (see below). We use them to create unique identifiers for objects. But it is better to learn this datatype after you understand the Object type.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">const symbol1 = Symbol();\r\n\r\nconst symbol2 = Symbol(5);<\/pre>\n<h2>JavaScript Datatypes (Non-Primitive)<\/h2>\n<p><span style=\"font-weight: 400\">The non-primitive datatypes in JavaScript include <em>objects, arrays, and functions<\/em>. Each of these data types is a different topic in itself. So you will learn\u00a0all about them thoroughly in our later tutorials. For now, just try to understand the basics about them and the reason why these are present in JavaScript.<\/span><\/p>\n<h3><span style=\"font-weight: 400\">1. Objects<\/span><\/h3>\n<p><span style=\"font-weight: 400\">The object type refers to the collection of primitive as well as complex data types. Object properties exist in key: value pairs, separated by commas. Property values can be values of any type, including other objects, thus these are wonderful to build complex data structures. A key value is <strong>a String or a Symbol value.<\/strong><\/span><\/p>\n<p><span style=\"font-weight: 400\">You can imagine an object as a container, with the content of the container changing with time. We declare them in <\/span><b>curly brackets { }<\/b><span style=\"font-weight: 400\">.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">var employee = {name: \u201cKamal\u201d, age: 45; dept: \u201cHR\u201d};\r\n<\/pre>\n<p><span style=\"font-weight: 400\">We created an object with three properties here: <em>name, age, and dept.<\/em> Also, we can create an empty object with the syntax:<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">var employee = { };<\/pre>\n<h3><span style=\"font-weight: 400\">2. Arrays<\/span><\/h3>\n<p><span style=\"font-weight: 400\">Arrays are a special type of object in JavaScript. The main difference between arrays and objects is that array contents have a natural order and the keys are numeric and sequential. On the other hand, object keys can be numeric as well as strings. Remember, we declare arrays in <b style=\"font-size: 16px\">square brackets [ ]<\/b><span style=\"font-weight: 400\">. Unlike other programming languages like Java where you can only store similar types of data in arrays, you can store any type of data within a single JavaScript array. <\/span><span style=\"font-weight: 400\">But the data that is stored in JavaScript arrays should be correlated.<\/span><\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">var employees = [ ];<\/pre>\n<p><span style=\"font-weight: 400\">This will create an empty array, and we can later add values to it. Or we can create an array with objects in the following manner:<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">var array1 = [\u201cKamal\u201d, \u201cRita\u201d, 22, 48.0]\r\n\r\n<\/pre>\n<h3>3. Functions<\/h3>\n<p><span style=\"font-weight: 400\">Functions in JavaScript, like in every other programming language, act as a wrapper around a piece of code. We use functions when we want to use the same code repeatedly, but not to rewrite it every time. Once defined, all we need to do is to call that function to make use of it. We define them with the keyword function, followed by <em>parenthesis ( )<\/em> and then the code you want to write.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">function myFunction( ){ }<\/pre>\n<p><span style=\"font-weight: 400\">This method will create an empty function with no parameters and an empty body. You can add parameters in the parenthesis ( ) or add a body in the <em>curly brackets { }<\/em>.<\/span><\/p>\n<p><em><strong>You must have a look at our most trending article on <a href=\"https:\/\/data-flair.training\/blogs\/javascript-function\/\">JavaScript Functions<\/a><\/strong><\/em><\/p>\n<h3><span style=\"font-weight: 400\">The typeof() Operator<\/span><\/h3>\n<p><span style=\"font-weight: 400\">This operator determines the type of the JavaScript variable. It takes the variable as a parameter and returns the type of a variable or an expression. In the case of a complex data type, it returns an <\/span><b>object<\/b><span style=\"font-weight: 400\"><em> (objects, arrays, and null)<\/em> or <\/span><b>function<\/b><span style=\"font-weight: 400\"><em> (functions)<\/em>. Let\u2019s sum up all we learned about the data types with the help of a code:<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;html&gt;\r\n  &lt;body&gt;\r\n\r\n    &lt;script&gt;\r\n      document.write(\"Checking numbers:\" + \"&lt;\/br&gt;\");\r\n                        document.write(\"10: \");\r\n                        document.write(typeof 10 + \"&lt;\/br&gt;\");\r\n                        document.write(\"10.0: \");\r\n                        document.write(typeof 10.0 + \"&lt;\/br&gt;\");\r\n                        document.write(\"9007199254740992n: \");\r\n                        document.write(typeof 9007199254740992n + \"&lt;\/br&gt;\" + \"&lt;\/br&gt;\");\r\n                        document.write(\"Checking booleans:\" + \"&lt;\/br&gt;\");\r\n                        document.write(\"3 == 5: \");\r\n                        document.write(typeof (3 == 5) + \"&lt;\/br&gt;\");\r\n                        document.write(\"12 == '12': \");\r\n                        document.write(typeof (12 == '12') + \"&lt;\/br&gt;\" + \"&lt;\/br&gt;\");\r\n                        document.write(\"Checking strings:\" + \"&lt;\/br&gt;\");\r\n                        document.write(\"DataFlair: \");\r\n                        document.write(typeof \"DataFlair\" + \"&lt;\/br&gt;\" + \"&lt;\/br&gt;\");\r\n                        document.write(\"Checking undefined:\" + \"&lt;\/br&gt;\");\r\n                        var myVariable;\r\n                        document.write(\"myVariable: \");\r\n                        document.write(typeof myVariable + \"&lt;\/br&gt;\" + \"&lt;\/br&gt;\");\r\n                        document.write(\"Checking symbol:\" + \"&lt;\/br&gt;\");\r\n                        const symbol1 = Symbol();\r\n                        document.write(\"symbol1: \");\r\n                        document.write(typeof symbol1 + \"&lt;\/br&gt;\");\r\n                        const symbol2 = Symbol(5);\r\n                        document.write(\"symbol2: \");\r\n                        document.write(typeof symbol2 + \"&lt;\/br&gt;\" + \"&lt;\/br&gt;\");\r\n                        document.write(\"Checking objects and functions:\" + \"&lt;\/br&gt;\");\r\n                        var name1 = null;\r\n                        document.write(\"null: \");\r\n                        document.write(typeof name1 + \"&lt;\/br&gt;\");\r\n                        document.write(\"object1: \");\r\n                        document.write(typeof { } + \"&lt;\/br&gt;\");\r\n                        document.write(\"array1: \");\r\n                        document.write(typeof [ ] + \"&lt;\/br&gt;\");\r\n                        document.write(\"myFunction: \");\r\n                        document.write(typeof function myFunction( ){ } + \"&lt;\/br&gt;\" + \"&lt;\/br&gt;\");\r\n    &lt;\/script&gt;\r\n\r\n  &lt;\/body&gt;\r\n&lt;\/html&gt;\r\n\r\n\r\n\r\n\r\n<\/pre>\n<p><strong>Screenshot:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/typeof.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-66088 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/typeof.jpg\" alt=\"typeof - JavaScript Data Types\" width=\"1299\" height=\"741\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/typeof.jpg 1299w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/typeof-150x86.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/typeof-300x171.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/typeof-768x438.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/typeof-1024x584.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/typeof-520x297.jpg 520w\" sizes=\"auto, (max-width: 1299px) 100vw, 1299px\" \/><\/a><\/p>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/typeof-output.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-66089 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/typeof-output.jpg\" alt=\"typeof output - JavaScript Data Types\" width=\"1299\" height=\"741\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/typeof-output.jpg 1299w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/typeof-output-150x86.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/typeof-output-300x171.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/typeof-output-768x438.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/typeof-output-1024x584.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/typeof-output-520x297.jpg 520w\" sizes=\"auto, (max-width: 1299px) 100vw, 1299px\" \/><\/a><\/p>\n<h2><span style=\"font-weight: 400\">Summary<\/span><\/h2>\n<p><span style=\"font-weight: 400\">With this, we come to the end of our tutorial on JavaScript Datatypes. In the above article, we took a brief look at what is JavaScript data types, primitive and non-primitive data types, <em>typeOf()<\/em> Operator. After learning about data types, you have entered into the world of JavaScript. You need to understand the code really well before moving forward.\u00a0<\/span><\/p>\n<p><b><i>Next article for you &#8211; <a href=\"https:\/\/data-flair.training\/blogs\/javascript-conditional-statements\/\">JavaScript Conditional Statements<\/a><\/i><\/b><\/p>\n<p>Hope the information provided was useful to you.<\/p>\n<p>Don&#8217;t forget to drop your feedback below in the comment section.<span hidden class=\"__iawmlf-post-loop-links\" data-iawmlf-links=\"[{&quot;id&quot;:1462,&quot;href&quot;:&quot;https:\\\/\\\/developer.mozilla.org\\\/en-US\\\/docs\\\/Web\\\/JavaScript\\\/Reference\\\/Global_Objects\\\/String&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20251008034553\\\/https:\\\/\\\/developer.mozilla.org\\\/en-US\\\/docs\\\/Web\\\/JavaScript\\\/Reference\\\/Global_Objects\\\/String&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2025-12-09 07:45:51&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-29 14:10:28&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-05 16:37:06&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-10 14:51:17&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-15 19:41:30&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-12 22:13:22&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-23 10:29:20&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-10 03:43:18&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-13 19:34:56&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-24 13:00:06&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-13 10:40:21&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-22 03:05:31&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-01 17:02:34&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-08 19:51:51&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-14 11:40:51&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-18 08:59:44&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-23 05:13:11&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-28 21:26:01&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-11 20:24:53&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-20 14:05:37&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-25 15:00:20&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-07-04 08:49:46&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-07-09 13:12:23&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-07-15 09:55:14&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-07-19 03:47:38&quot;,&quot;http_code&quot;:206}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-07-19 03:47:38&quot;,&quot;http_code&quot;:206},&quot;process&quot;:&quot;done&quot;}]\"><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The data types in JavaScript looks simple and useless but having an insight on how they work is essential. Data types help to provide a better understanding of the language and its behaviour.\u00a0Today, with&#46;&#46;&#46;<\/p>\n","protected":false},"author":7,"featured_media":66563,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18979],"tags":[2153,18983,20772,20771,13898],"class_list":["post-62424","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript","tag-boolean-data-types","tag-javascript-data-types","tag-non-primitive-javascript-data-types","tag-primitive-javascript-data-types","tag-string-data-types"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>JavaScript Data Types - Grab complete knowledge about Data Types! - DataFlair<\/title>\n<meta name=\"description\" content=\"Take a deep insight into JavaScript data types by learning about primitive and non-primitive data types and typeOf() operator with syntax and their use in JavaScript.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/javascript-data-types\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JavaScript Data Types - Grab complete knowledge about Data Types! - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Take a deep insight into JavaScript data types by learning about primitive and non-primitive data types and typeOf() operator with syntax and their use in JavaScript.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/javascript-data-types\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2019-08-01T06:13:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-02-17T16:02:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/JavaScript-data-types.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"420\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JavaScript Data Types - Grab complete knowledge about Data Types! - DataFlair","description":"Take a deep insight into JavaScript data types by learning about primitive and non-primitive data types and typeOf() operator with syntax and their use in JavaScript.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/javascript-data-types\/","og_locale":"en_US","og_type":"article","og_title":"JavaScript Data Types - Grab complete knowledge about Data Types! - DataFlair","og_description":"Take a deep insight into JavaScript data types by learning about primitive and non-primitive data types and typeOf() operator with syntax and their use in JavaScript.","og_url":"https:\/\/data-flair.training\/blogs\/javascript-data-types\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2019-08-01T06:13:09+00:00","article_modified_time":"2021-02-17T16:02:32+00:00","og_image":[{"width":800,"height":420,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/JavaScript-data-types.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/javascript-data-types\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/javascript-data-types\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/beb0cab24b7aa54423a3b50e669a9dcd"},"headline":"JavaScript Data Types &#8211; Grab complete knowledge about Data Types!","datePublished":"2019-08-01T06:13:09+00:00","dateModified":"2021-02-17T16:02:32+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/javascript-data-types\/"},"wordCount":1272,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/javascript-data-types\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/JavaScript-data-types.jpg","keywords":["Boolean Data Types","JavaScript Data Types","Non-primitive JavaScript Data Types","Primitive JavaScript Data Types","String Data Types"],"articleSection":["JavaScript Tutorial"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/javascript-data-types\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/javascript-data-types\/","url":"https:\/\/data-flair.training\/blogs\/javascript-data-types\/","name":"JavaScript Data Types - Grab complete knowledge about Data Types! - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/javascript-data-types\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/javascript-data-types\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/JavaScript-data-types.jpg","datePublished":"2019-08-01T06:13:09+00:00","dateModified":"2021-02-17T16:02:32+00:00","description":"Take a deep insight into JavaScript data types by learning about primitive and non-primitive data types and typeOf() operator with syntax and their use in JavaScript.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/javascript-data-types\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/javascript-data-types\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/javascript-data-types\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/JavaScript-data-types.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/JavaScript-data-types.jpg","width":800,"height":420,"caption":"JavaScript data types"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/javascript-data-types\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"JavaScript Tutorial","item":"https:\/\/data-flair.training\/blogs\/category\/javascript\/"},{"@type":"ListItem","position":3,"name":"JavaScript Data Types &#8211; Grab complete knowledge about Data Types!"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/beb0cab24b7aa54423a3b50e669a9dcd","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team specializes in creating clear, actionable content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Backed by industry expertise, we make learning easy and career-oriented for beginners and pros alike.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam3\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/62424","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=62424"}],"version-history":[{"count":19,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/62424\/revisions"}],"predecessor-version":[{"id":67697,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/62424\/revisions\/67697"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/66563"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=62424"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=62424"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=62424"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}