Fundamentals of let, const, var 🚀

Variables: Variables in JavaScript are containers for storing data. JavaScript allows the usage of variables in the following three ways:

var:

var is the most commonly used variable in JavaScript. It can be initialized to a value, redeclare…


This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by Khalid🥑💻

Variables: Variables in JavaScript are containers for storing data. JavaScript allows the usage of variables in the following three ways:

var:

var is the most commonly used variable in JavaScript. It can be initialized to a value, redeclared and its value can be reassigned, but only inside the context of a function. It can be function scoped or globally scoped.

using var

let:

let in JavaScript is similar to var only difference lies in the scope. var is function scoped, let is block scoped. It cannot be redeclared but can be reassigned a value.

Using let

const:

const in JavaScript is used to declare a fixed value that cannot be changed over time once declared. They can neither be redeclared nor be reassigned. They cannot be hoisted either.

Using const

📢Connect with me on LinkedIn🚀


This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by Khalid🥑💻


Print Share Comment Cite Upload Translate Updates
APA

Khalid🥑💻 | Sciencx (2022-09-29T04:16:13+00:00) Fundamentals of let, const, var 🚀. Retrieved from https://www.scien.cx/2022/09/29/fundamentals-of-let-const-var-%f0%9f%9a%80/

MLA
" » Fundamentals of let, const, var 🚀." Khalid🥑💻 | Sciencx - Thursday September 29, 2022, https://www.scien.cx/2022/09/29/fundamentals-of-let-const-var-%f0%9f%9a%80/
HARVARD
Khalid🥑💻 | Sciencx Thursday September 29, 2022 » Fundamentals of let, const, var 🚀., viewed ,<https://www.scien.cx/2022/09/29/fundamentals-of-let-const-var-%f0%9f%9a%80/>
VANCOUVER
Khalid🥑💻 | Sciencx - » Fundamentals of let, const, var 🚀. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/09/29/fundamentals-of-let-const-var-%f0%9f%9a%80/
CHICAGO
" » Fundamentals of let, const, var 🚀." Khalid🥑💻 | Sciencx - Accessed . https://www.scien.cx/2022/09/29/fundamentals-of-let-const-var-%f0%9f%9a%80/
IEEE
" » Fundamentals of let, const, var 🚀." Khalid🥑💻 | Sciencx [Online]. Available: https://www.scien.cx/2022/09/29/fundamentals-of-let-const-var-%f0%9f%9a%80/. [Accessed: ]
rf:citation
» Fundamentals of let, const, var 🚀 | Khalid🥑💻 | Sciencx | https://www.scien.cx/2022/09/29/fundamentals-of-let-const-var-%f0%9f%9a%80/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.