Skip to main content

Posts

Showing posts with the label LET

Different between VAR, LET and CONST in JavaScript with examples.

Hello Guys, In this blog we are going to learn about LET, CONT, VAR keywords in JavaScript. To store data in JavaScript, you have three ways of declaring variables: var, const, and let.   These three have the same purpose but vary in certain aspects. Familiarizing yourself with the contrasts can guide you on which to select for your unique requirements. JavaScript's let, const, and var have some notable distinctions to consider. `LET` :-  Here's an example: the let keyword enables block-scoped variables to be declared.  Only the block where it was declared and any nested blocks within it have access to a variable with let due to block scoping. Introduced in ES6, let offers this capability. The concept of variable shadowing is demonstrated by the double declaration of let for x.  Despite sharing a name, one instance occurs in the example function block and the other occurs within the if block.  They can be treated as individual variables due to their separate block declaratio

How to use Java-Script Let & Const Overview ( ES 6 ) with examples

Hey Guys, in this blog we are going to learn about What is the different between   LET and CONST key word ( ES 6)    with examples  Let's get started... LET: Let  key word now we are using for  declaring variables . It's not like a surprise because it's come with improvement of  VAR  keywords. In  Let , we can declare variables like we are declaring using the  VAR keyword  but in  LET  keyword we cannot re-declare that variables like below. but we can change the value of variable like beow CONST: In  CONST  keyword we are using when we have  static value.  Let assume you have one value that  not going to change anywhere in the function of the file  in that case we can use  CONST  Keywords. we can not re-declare const variable and we can not update const keyword value like below. but we can use it like below. If you guys have any query then you can drop a mail to us on this mail id: techoswag@gmail.com