Menu

1 / 12

var, let and const—from Ambiguity to Specificity

DEV Community·Robert Hieger·6 months ago
#1U6s7Vbo
#why#reassignment#javascript#value#const
Reading 0:00
15s threshold

Jorge Jesus, Pexels.com

Introduction

Prior to the advent of the ECMAScript 6 standard ( ES6 ) on June 17, 2015, there was only one way to declare a variable in JavaScript: using the var keyword.

From ES6 onward, standards have been identified with the year of their finalization. For example, ES6 was also known as ES2015 . Successive standards have been named in the same way—e.g. ES2016 , ES2017 , etc.

The var keyword, in earlier standards of JavaScript , dating back as far as the first ratified standard in 1997— ECMAScript 1 ( ECMA-262 )—served the purpose of declaring variables in the most flexible manner possible, allowing re-declaration of a variable already declared, and reassignment of values regardless of data type.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.