Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,171,454 members, 7,881,603 topics. Date: Saturday, 06 July 2024 at 02:24 AM |
Nairaland Forum / Science/Technology / Programming / Difference Between Var, Let And Const Keywords In Javascript (415 Views)
Javascripters: Telegram Group To All Interested In Javascript And Its Ecosystem / How To Retrieve Data From An Api Using Fetch Api In Javascript / How Do I Convert Object To Arrey In Javascript (2) (3) (4)
(1) (Reply)
Difference Between Var, Let And Const Keywords In Javascript by HiNode(m): 2:04pm On Aug 18, 2022 |
Difference between var, let and const keywords in JavaScript In JavaScript, users can declare a variable using 3 keywords that are var, let, and const. In this article, we will see the differences between the var, let, and const keywords. We will discuss the scope and other required concepts about each keyword. var keyword in JavaScript: The var is the oldest keyword to declare a variable in JavaScript. var is lexically scoped meaning when declare, you can assess it any where in your code and it Can be reassigned to another variable. let keyword in JavaScript: The let keyword is an improved version of the var keyword. Scope: block scoped: The scope of a let variable is only block scoped. It can’t be accessible outside the particular block. Blocks like (if) block and (for loop) block. const keyword in JavaScript: The const keyword has all the properties that are the same as the let keyword, except the user cannot update it. It is also a block scoped: When users declare a const variable, they need to initialize it, otherwise, it returns an error. The user cannot update the const variable once it is declared. #learnjavascript If you gain something from this, kindly help me view my gig page and make impression https://www.fiverr.com/share/xjD32l Follow me on twitter @Tmobytech |
Re: Difference Between Var, Let And Const Keywords In Javascript by HiNode(m): 6:56am On Aug 19, 2022 |
Javascript is in high demand now, #learnjavaScript |
(1) (Reply)
I Noticed All META Apps I.e Facebook And Co Have Disappeared From My Phone. / Python: Explorative Data Analysis, Replacing Nan. Help! / What Does It Cost To Build A Fintech Apps
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 21 |