{"id":11363,"date":"2014-01-22T15:50:22","date_gmt":"2014-01-22T10:20:22","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=11363"},"modified":"2014-01-22T15:50:22","modified_gmt":"2014-01-22T10:20:22","slug":"constants-in-javascript","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/constants-in-javascript\/","title":{"rendered":"Constants In JavaScript"},"content":{"rendered":"<p>We can create constants in JavaScript using <strong>&#8216;const&#8217;<\/strong> keyword.<br \/>\n[js]<br \/>\nconst name = &#8216;Sakshi&#8217;<br \/>\nconsole.log(name)<br \/>\n[\/js]<br \/>\nThis will print: Sakshi<br \/>\nNow, if we try to change or re-initialize &#8216;name&#8217; constant, the value will not change.<br \/>\n[js]<br \/>\nconst name = &#8216;Hello&#8217;<br \/>\nconsole.log(name)<br \/>\n[\/js]<br \/>\nThis will again print: Sakshi<\/p>\n<p><strong>Compatibility: <\/strong>&#8216;const&#8217; is supported in Firefox &amp; Chrome. Some compatibility issue with Internet Explorer 10 and lower, opera and some other browsers. It is going to be defined by ECMAScript 6 soon. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>We can create constants in JavaScript using &#8216;const&#8217; keyword. [js] const name = &#8216;Sakshi&#8217; console.log(name) [\/js] This will print: Sakshi Now, if we try to change or re-initialize &#8216;name&#8217; constant, the value will not change. [js] const name = &#8216;Hello&#8217; console.log(name) [\/js] This will again print: Sakshi Compatibility: &#8216;const&#8217; is supported in Firefox &amp; Chrome. [&hellip;]<\/p>\n","protected":false},"author":65,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":4,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-11363","post","type-post","status-publish","format-standard","hentry","category-technology"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"We can create constants in JavaScript using &#039;const&#039; keyword. [js] const name = &#039;Sakshi&#039; console.log(name) [\/js] This will print: Sakshi Now, if we try to change or re-initialize &#039;name&#039; constant, the value will not change. [js] const name = &#039;Hello&#039; console.log(name) [\/js] This will again print: Sakshi Compatibility: &#039;const&#039; is supported in Firefox &amp; Chrome.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Sakshi Tyagi\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.tothenew.com\/blog\/constants-in-javascript\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"TO THE NEW BLOG\" \/>\n\t\t<meta property=\"og:type\" content=\"blog\" \/>\n\t\t<meta property=\"og:title\" content=\"Constants In JavaScript | TO THE NEW Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"We can create constants in JavaScript using &#039;const&#039; keyword. [js] const name = &#039;Sakshi&#039; console.log(name) [\/js] This will print: Sakshi Now, if we try to change or re-initialize &#039;name&#039; constant, the value will not change. [js] const name = &#039;Hello&#039; console.log(name) [\/js] This will again print: Sakshi Compatibility: &#039;const&#039; is supported in Firefox &amp; Chrome.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.tothenew.com\/blog\/constants-in-javascript\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@tothenew\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Constants In JavaScript | TO THE NEW Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"We can create constants in JavaScript using &#039;const&#039; keyword. [js] const name = &#039;Sakshi&#039; console.log(name) [\/js] This will print: Sakshi Now, if we try to change or re-initialize &#039;name&#039; constant, the value will not change. [js] const name = &#039;Hello&#039; console.log(name) [\/js] This will again print: Sakshi Compatibility: &#039;const&#039; is supported in Firefox &amp; Chrome.\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/constants-in-javascript\\\/#article\",\"name\":\"Constants In JavaScript | TO THE NEW Blog\",\"headline\":\"Constants In JavaScript\",\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/sakshi\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"},\"datePublished\":\"2014-01-22T15:50:22+05:30\",\"dateModified\":\"2014-01-22T15:50:22+05:30\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/constants-in-javascript\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/constants-in-javascript\\\/#webpage\"},\"articleSection\":\"Technology\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/constants-in-javascript\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"position\":2,\"name\":\"Technology\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/constants-in-javascript\\\/#listItem\",\"name\":\"Constants In JavaScript\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/constants-in-javascript\\\/#listItem\",\"position\":3,\"name\":\"Constants In JavaScript\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\",\"name\":\"TO THE NEW Blog\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/sakshi\\\/#author\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/sakshi\\\/\",\"name\":\"Sakshi Tyagi\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/constants-in-javascript\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a42c6deb088e18815dfcfed629c77b032d17bf973881421880b9c5e4ba713739?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Sakshi Tyagi\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/constants-in-javascript\\\/#webpage\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/constants-in-javascript\\\/\",\"name\":\"Constants In JavaScript | TO THE NEW Blog\",\"description\":\"We can create constants in JavaScript using 'const' keyword. [js] const name = 'Sakshi' console.log(name) [\\\/js] This will print: Sakshi Now, if we try to change or re-initialize 'name' constant, the value will not change. [js] const name = 'Hello' console.log(name) [\\\/js] This will again print: Sakshi Compatibility: 'const' is supported in Firefox & Chrome.\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/constants-in-javascript\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/sakshi\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/sakshi\\\/#author\"},\"datePublished\":\"2014-01-22T15:50:22+05:30\",\"dateModified\":\"2014-01-22T15:50:22+05:30\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\",\"name\":\"TO THE NEW Blog\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Constants In JavaScript | TO THE NEW Blog","description":"We can create constants in JavaScript using 'const' keyword. [js] const name = 'Sakshi' console.log(name) [\/js] This will print: Sakshi Now, if we try to change or re-initialize 'name' constant, the value will not change. [js] const name = 'Hello' console.log(name) [\/js] This will again print: Sakshi Compatibility: 'const' is supported in Firefox & Chrome.","canonical_url":"https:\/\/www.tothenew.com\/blog\/constants-in-javascript\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.tothenew.com\/blog\/constants-in-javascript\/#article","name":"Constants In JavaScript | TO THE NEW Blog","headline":"Constants In JavaScript","author":{"@id":"https:\/\/www.tothenew.com\/blog\/author\/sakshi\/#author"},"publisher":{"@id":"https:\/\/www.tothenew.com\/blog\/#organization"},"datePublished":"2014-01-22T15:50:22+05:30","dateModified":"2014-01-22T15:50:22+05:30","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/www.tothenew.com\/blog\/constants-in-javascript\/#webpage"},"isPartOf":{"@id":"https:\/\/www.tothenew.com\/blog\/constants-in-javascript\/#webpage"},"articleSection":"Technology"},{"@type":"BreadcrumbList","@id":"https:\/\/www.tothenew.com\/blog\/constants-in-javascript\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/www.tothenew.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog\/category\/technology\/#listItem","name":"Technology"}},{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog\/category\/technology\/#listItem","position":2,"name":"Technology","item":"https:\/\/www.tothenew.com\/blog\/category\/technology\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog\/constants-in-javascript\/#listItem","name":"Constants In JavaScript"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog\/constants-in-javascript\/#listItem","position":3,"name":"Constants In JavaScript","previousItem":{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog\/category\/technology\/#listItem","name":"Technology"}}]},{"@type":"Organization","@id":"https:\/\/www.tothenew.com\/blog\/#organization","name":"TO THE NEW Blog","url":"https:\/\/www.tothenew.com\/blog\/"},{"@type":"Person","@id":"https:\/\/www.tothenew.com\/blog\/author\/sakshi\/#author","url":"https:\/\/www.tothenew.com\/blog\/author\/sakshi\/","name":"Sakshi Tyagi","image":{"@type":"ImageObject","@id":"https:\/\/www.tothenew.com\/blog\/constants-in-javascript\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/a42c6deb088e18815dfcfed629c77b032d17bf973881421880b9c5e4ba713739?s=96&d=mm&r=g","width":96,"height":96,"caption":"Sakshi Tyagi"}},{"@type":"WebPage","@id":"https:\/\/www.tothenew.com\/blog\/constants-in-javascript\/#webpage","url":"https:\/\/www.tothenew.com\/blog\/constants-in-javascript\/","name":"Constants In JavaScript | TO THE NEW Blog","description":"We can create constants in JavaScript using 'const' keyword. [js] const name = 'Sakshi' console.log(name) [\/js] This will print: Sakshi Now, if we try to change or re-initialize 'name' constant, the value will not change. [js] const name = 'Hello' console.log(name) [\/js] This will again print: Sakshi Compatibility: 'const' is supported in Firefox & Chrome.","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/www.tothenew.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/www.tothenew.com\/blog\/constants-in-javascript\/#breadcrumblist"},"author":{"@id":"https:\/\/www.tothenew.com\/blog\/author\/sakshi\/#author"},"creator":{"@id":"https:\/\/www.tothenew.com\/blog\/author\/sakshi\/#author"},"datePublished":"2014-01-22T15:50:22+05:30","dateModified":"2014-01-22T15:50:22+05:30"},{"@type":"WebSite","@id":"https:\/\/www.tothenew.com\/blog\/#website","url":"https:\/\/www.tothenew.com\/blog\/","name":"TO THE NEW Blog","inLanguage":"en-US","publisher":{"@id":"https:\/\/www.tothenew.com\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"TO THE NEW BLOG","og:type":"blog","og:title":"Constants In JavaScript | TO THE NEW Blog","og:description":"We can create constants in JavaScript using 'const' keyword. [js] const name = 'Sakshi' console.log(name) [\/js] This will print: Sakshi Now, if we try to change or re-initialize 'name' constant, the value will not change. [js] const name = 'Hello' console.log(name) [\/js] This will again print: Sakshi Compatibility: 'const' is supported in Firefox &amp; Chrome.","og:url":"https:\/\/www.tothenew.com\/blog\/constants-in-javascript\/","og:image":"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","og:image:secure_url":"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","twitter:card":"summary","twitter:site":"@tothenew","twitter:title":"Constants In JavaScript | TO THE NEW Blog","twitter:description":"We can create constants in JavaScript using 'const' keyword. [js] const name = 'Sakshi' console.log(name) [\/js] This will print: Sakshi Now, if we try to change or re-initialize 'name' constant, the value will not change. [js] const name = 'Hello' console.log(name) [\/js] This will again print: Sakshi Compatibility: 'const' is supported in Firefox &amp; Chrome.","twitter:image":"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png"},"aioseo_meta_data":{"post_id":"11363","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"created":"2021-04-30 08:06:02","updated":"2024-02-29 10:50:14","focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.tothenew.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.tothenew.com\/blog\/category\/technology\/\" title=\"Technology\">Technology<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tConstants In JavaScript\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.tothenew.com\/blog"},{"label":"Technology","link":"https:\/\/www.tothenew.com\/blog\/category\/technology\/"},{"label":"Constants In JavaScript","link":"https:\/\/www.tothenew.com\/blog\/constants-in-javascript\/"}],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/11363","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/65"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=11363"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/11363\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=11363"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=11363"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=11363"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}