let same as var in javascript

Something Like that:
let same as var

For that you need to create first html code.

HTML

<p>Value of function a =  <span id="demo1"></span></p>

After that add this JS code.

JS

let a = 10,
    b = 5;
//let same as var;
if(a > b){
    let c = true;
  document.getElementById("demo1").innerHTML = c;
}

[codepen_embed height=”265″ theme_id=”0″ slug_hash=”KvVjKr” default_tab=”result” user=”pradeepanvi”]See the Pen let same as var in javascript by Pradeep Kumar (@pradeepanvi) on CodePen.[/codepen_embed]

Now you can see

Value of c = true

We can also use let instead of var

Leave a Reply

Your email address will not be published. Required fields are marked *