{"id":6617,"date":"2025-01-13T09:20:39","date_gmt":"2025-01-13T09:20:39","guid":{"rendered":"https:\/\/ubiq.co\/tech-blog\/?p=6617"},"modified":"2025-01-13T09:35:01","modified_gmt":"2025-01-13T09:35:01","slug":"what-does-strict-do-in-javascript","status":"publish","type":"post","link":"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/","title":{"rendered":"What Does Strict Do in JavaScript"},"content":{"rendered":"\n<p>Web developers often wonder what does strict keyword do in JavaScript. We come across this keyword at the beginning of JavaScript file, or a function. Although it looks very simple and casual, it is a very important command and must be used very carefully. If you do not completely know how strict keyword works, adding it to your code may cause it to stop working properly. In this article, we will learn what is strict keyword, how to use it and what it does.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/#What_is_Strict_Keyword\" >What is Strict Keyword<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/#How_to_Use_Strict_Keyword\" >How to Use Strict Keyword<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/#What_Does_Strict_Do_in_JavaScript\" >What Does Strict Do in JavaScript<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/#1_Assignment_Without_Declaration\" >1. Assignment Without Declaration<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/#2_Deleting_Variable_or_function\" >2. Deleting Variable or function<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/#3_No_duplicate_parameters\" >3. No duplicate parameters<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/#4_Octal_Literals_and_Escape_Characters\" >4. Octal Literals and Escape Characters<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/#5_Writing_to_Read-only_Property\" >5. Writing to Read-only Property<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/#6_Use_of_eval\" >6. Use of eval<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/#7_Keywords_as_variable_names\" >7. Keywords as variable names<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_Strict_Keyword\"><\/span>What is Strict Keyword<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The strict keyword was introduced in ECMAScript 5 to enforce certain amount of rigidity in coding practices. Generally, JavaScript is quite flexible and in most cases, it automatically interprets your code correctly even if you do not strictly adhere to the syntax and coding practices. But over time, this can cause many bugs to creep into your code. Also, in some cases of critical codes and modules, you may want the code to be written in a particular manner to avoid ambiguity.<\/p>\n\n\n\n<p>In all such cases, you can use strict keyword. When you add this to your script or function, it will force the web browser to execute the code in strict mode. It enforces a set of rules on your code, and if any of them is not adhered to, forces the web browser to throw an error.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_to_Use_Strict_Keyword\"><\/span>How to Use Strict Keyword<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>You can simply use strict keyword in your code by adding &#8216;use strict&#8217; at the beginning of your script or function. If you add it to the beginning of your script, then it has a global scope and will execute all the following code in the script in strict mode. Here is an example to illustrate it.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\"use strict\";<br>a = 123; \/\/ will give error<\/pre>\n\n\n\n<p>In the above code, we add &#8216;use strict&#8217; at the beginning of page. It will execute the next line of code in strict mode an give error since the variable a has been assigned without declaring.<\/p>\n\n\n\n<p>You can also add it to the beginning of the function.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">function abc(){<br>\"use strict\";<br>  a = 123;<br>}<\/pre>\n\n\n\n<p>In the above code, we add &#8216;use strict&#8217; at the beginning of the function. In this case, only when you call the function, you will get an error since its local variable is used before declaration. However, rest of the code in the script remains unaffected.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_Does_Strict_Do_in_JavaScript\"><\/span>What Does Strict Do in JavaScript<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Using strict keyword in your code will cause many things to happen. So you need to be really careful before you use it. Let us look at some of the important changes. Please note, this is not an exhaustive list.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_Assignment_Without_Declaration\"><\/span>1. Assignment Without Declaration<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Using variables and objects without declaration is generally allowed in JavaScript but not allowed in Strict mode. The following codes will throw an error, since in each case, we are using variable\/object without declaring them.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\"use strict\"<br>a = 123; \/\/ throws error<br><br>data = {'b':1,'c':3};  \/\/ throws error<\/pre>\n\n\n\n<p>On a similar note, assignments that used to fail silently earlier, will throw an error in strict mode. Here is an example that would fail silently in normal mode, but gives an error in strict mode.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\"use strict\";<br>NaN = 5;<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_Deleting_Variable_or_function\"><\/span>2. Deleting Variable or function<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Also, once you declare a variable, you cannot delete it. If you try to delete it, then your web browser will throw an error. Here&#8217;s an example.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\"use strict\";<br>var a = 123;<br>delete a; \/\/ throws error<\/pre>\n\n\n\n<p>Similarly, you cannot delete a function in strict mode. Otherwise, it too will give an error.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\"use strict\";<br>function abc(p1){};<br>delete abc;  \/\/ throws error<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3_No_duplicate_parameters\"><\/span>3. No duplicate parameters<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>By default, if you accidentally define duplicate parameters in a function definition, JavaScript will continue execution. However, in strict mode, all function parameters must be unique. If there is any duplicate parameter, or a parameter name is repeated in function definition, then you will get an error.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\"use strict\";<br>function a(b, b){}; \/\/ gives error<\/pre>\n\n\n\n<p>Similarly, you cannot use duplicate property names in object literals. But the good part is that this is applicable on old browsers and not ones that support <a href=\"https:\/\/www.w3schools.com\/js\/js_es6.asp\" target=\"_blank\" rel=\"noreferrer noopener\">ECMAScript 6<\/a>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\"use strict\";<br>var data = {'a':1, 'a':2,'b':3}; \/\/ gives error<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"4_Octal_Literals_and_Escape_Characters\"><\/span>4. Octal Literals and Escape Characters<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Generally, the following code will be executed without any error. The web browser will interpret the number as an octal numerical and parse it.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">a = 023;<br>console.log(a); \/\/ output is 19<\/pre>\n\n\n\n<p>But the above code will give an error when run in strict mode.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\"use strict\";<br>a = 023;<br>console.log(a); \/\/ gives error<\/pre>\n\n\n\n<p>Similarly, using octal escape characters such as &#8216;\\0&#8217; are also not allowed. Here is an example to demonstrate it.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\"use strict\";<br>a = '\\023';<\/pre>\n\n\n\n<p>In strict mode, octal numeric literals as well as octal escape characters are not allowed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"5_Writing_to_Read-only_Property\"><\/span>5. Writing to Read-only Property<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In strict mode, you cannot write to read-only property, because by definition they are not editable. Here is an example where define an object data and set its property x to be read only. Then if we try to write to it in strict mode, we will get an error.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\"use strict\";<br>const data = {};<br>Object.defineProperty(data, \"x\", {value:0, writable:false});<br><br>data.x = 123;    \/\/ gives error<\/pre>\n\n\n\n<p>Please note, the above code will run successfully without strict mode.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"6_Use_of_eval\"><\/span>6. Use of eval<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Eval() function evaluates an expression in JavaScript. However, for security reasons, there are many restrictions placed on its functionality, in strict mode. For example, you cannot use a variable name called eval in strict mode because it is a keyword.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\"use strict\";<br>let eval = 1; \/\/ gives error<\/pre>\n\n\n\n<p>Also, eval() function is not allowed to create variables from where it is called.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\"use strict\";<br>eval (\"x = 1\");<br>alert (x);      \/\/ gives error<\/pre>\n\n\n\n<p>The above example also gives an error because in strict mode, a variable cannot be used before it is defined.<\/p>\n\n\n\n<p>In fact, in eval() function, you are not even allowed to declare a variable using let or var keywords.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\"use strict\";<br>eval (\"var x = 1\");<br>alert(x);      \/\/ throws error<\/pre>\n\n\n\n<p>The following code will also give error.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\"use strict\";<br>eval (\"var x = 1\");<br>alert(x);      \/\/ throws error<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"7_Keywords_as_variable_names\"><\/span>7. Keywords as variable names<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Similarly, there are many other keywords that you cannot use as variable names, in strict mode. They are arguments, implements, interface, let, package, private, protected, public, static, yield.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\"use strict\";<br>let public = 123; \/\/ gives error<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In this article, we have learnt what strict keyword does in JavaScript. As you can see, it is very useful for enforcing coding discipline, especially in multi-developer environments. But use it only if you have to. Since strict keyword throws an exception in most cases, instead of letting go with a warning, it can break your code, if not used carefully. At this point, it does too many things and if you do not know them all, it can easily throw error. If you are adding it to an existing JavaScript file, make sure you also use plenty of unit tests to ensure that your code does not break. Nevertheless, it is very useful if you want to make sure that people don&#8217;t loosely add faulty code to your application or website.<\/p>\n\n\n\n<p>Also read:<\/p>\n\n\n\n<p><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-check-if-array-includes-value-in-javascript\/\">How to Check if Array Includes Value in JavaScript<\/a><br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-move-element-into-other-element-in-jquery\/\">How to Move Element Into Another Element in jQuery<\/a><br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-get-selected-text-from-dropdown-list-in-jquery\/\">How to Get Selected Text from Dropdown List in jQuery<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Web developers sometimes use strict keyword in their code. Let us learn what does strict do in JavaScript.<\/p>\n","protected":false},"author":1,"featured_media":6637,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[295],"tags":[374],"class_list":["post-6617","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript","tag-strict"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>What Does Strict Do in JavaScript - Ubiq BI<\/title>\n<meta name=\"description\" content=\"Web developers sometimes use strict keyword in their code. Let us learn what does strict do 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:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What Does Strict Do in JavaScript - Ubiq BI\" \/>\n<meta property=\"og:description\" content=\"Web developers sometimes use strict keyword in their code. Let us learn what does strict do in JavaScript.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/\" \/>\n<meta property=\"og:site_name\" content=\"Ubiq BI\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ubiqbi\" \/>\n<meta property=\"article:published_time\" content=\"2025-01-13T09:20:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-01-13T09:35:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/01\/what-does-strict-keyword-do.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"308\" \/>\n\t<meta property=\"og:image:height\" content=\"204\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Sreeram Sreenivasan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:site\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sreeram Sreenivasan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/\"},\"author\":{\"name\":\"Sreeram Sreenivasan\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc\"},\"headline\":\"What Does Strict Do in JavaScript\",\"datePublished\":\"2025-01-13T09:20:39+00:00\",\"dateModified\":\"2025-01-13T09:35:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/\"},\"wordCount\":1073,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/01\/what-does-strict-keyword-do.jpg?fit=308%2C204&ssl=1\",\"keywords\":[\"strict\"],\"articleSection\":[\"JavaScript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/\",\"url\":\"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/\",\"name\":\"What Does Strict Do in JavaScript - Ubiq BI\",\"isPartOf\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/01\/what-does-strict-keyword-do.jpg?fit=308%2C204&ssl=1\",\"datePublished\":\"2025-01-13T09:20:39+00:00\",\"dateModified\":\"2025-01-13T09:35:01+00:00\",\"author\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc\"},\"description\":\"Web developers sometimes use strict keyword in their code. Let us learn what does strict do in JavaScript.\",\"breadcrumb\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/#primaryimage\",\"url\":\"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/01\/what-does-strict-keyword-do.jpg?fit=308%2C204&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/01\/what-does-strict-keyword-do.jpg?fit=308%2C204&ssl=1\",\"width\":308,\"height\":204,\"caption\":\"what does strict do in javascript\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/ubiq.co\/tech-blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"What Does Strict Do in JavaScript\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/#website\",\"url\":\"https:\/\/ubiq.co\/tech-blog\/\",\"name\":\"Ubiq BI\",\"description\":\"Build dashboards &amp; reports in minutes\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/ubiq.co\/tech-blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc\",\"name\":\"Sreeram Sreenivasan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"caption\":\"Sreeram Sreenivasan\"},\"description\":\"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/sreeram-sreenivasan\/\"],\"url\":\"https:\/\/ubiq.co\/tech-blog\/author\/wordpress\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What Does Strict Do in JavaScript - Ubiq BI","description":"Web developers sometimes use strict keyword in their code. Let us learn what does strict do 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:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/","og_locale":"en_US","og_type":"article","og_title":"What Does Strict Do in JavaScript - Ubiq BI","og_description":"Web developers sometimes use strict keyword in their code. Let us learn what does strict do in JavaScript.","og_url":"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/","og_site_name":"Ubiq BI","article_publisher":"https:\/\/www.facebook.com\/ubiqbi","article_published_time":"2025-01-13T09:20:39+00:00","article_modified_time":"2025-01-13T09:35:01+00:00","og_image":[{"width":308,"height":204,"url":"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/01\/what-does-strict-keyword-do.jpg","type":"image\/jpeg"}],"author":"Sreeram Sreenivasan","twitter_card":"summary_large_image","twitter_creator":"@UbiqBI","twitter_site":"@UbiqBI","twitter_misc":{"Written by":"Sreeram Sreenivasan","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/#article","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/"},"author":{"name":"Sreeram Sreenivasan","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"headline":"What Does Strict Do in JavaScript","datePublished":"2025-01-13T09:20:39+00:00","dateModified":"2025-01-13T09:35:01+00:00","mainEntityOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/"},"wordCount":1073,"commentCount":0,"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/01\/what-does-strict-keyword-do.jpg?fit=308%2C204&ssl=1","keywords":["strict"],"articleSection":["JavaScript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/","url":"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/","name":"What Does Strict Do in JavaScript - Ubiq BI","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/#primaryimage"},"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/01\/what-does-strict-keyword-do.jpg?fit=308%2C204&ssl=1","datePublished":"2025-01-13T09:20:39+00:00","dateModified":"2025-01-13T09:35:01+00:00","author":{"@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"description":"Web developers sometimes use strict keyword in their code. Let us learn what does strict do in JavaScript.","breadcrumb":{"@id":"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/#primaryimage","url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/01\/what-does-strict-keyword-do.jpg?fit=308%2C204&ssl=1","contentUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/01\/what-does-strict-keyword-do.jpg?fit=308%2C204&ssl=1","width":308,"height":204,"caption":"what does strict do in javascript"},{"@type":"BreadcrumbList","@id":"https:\/\/ubiq.co\/tech-blog\/what-does-strict-do-in-javascript\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ubiq.co\/tech-blog\/"},{"@type":"ListItem","position":2,"name":"What Does Strict Do in JavaScript"}]},{"@type":"WebSite","@id":"https:\/\/ubiq.co\/tech-blog\/#website","url":"https:\/\/ubiq.co\/tech-blog\/","name":"Ubiq BI","description":"Build dashboards &amp; reports in minutes","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ubiq.co\/tech-blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc","name":"Sreeram Sreenivasan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","caption":"Sreeram Sreenivasan"},"description":"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.","sameAs":["https:\/\/www.linkedin.com\/in\/sreeram-sreenivasan\/"],"url":"https:\/\/ubiq.co\/tech-blog\/author\/wordpress\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/01\/what-does-strict-keyword-do.jpg?fit=308%2C204&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/pbGGTT-1IJ","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/6617","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/comments?post=6617"}],"version-history":[{"count":33,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/6617\/revisions"}],"predecessor-version":[{"id":6658,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/6617\/revisions\/6658"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media\/6637"}],"wp:attachment":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media?parent=6617"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/categories?post=6617"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/tags?post=6617"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}