dimanche 17 mai 2020

why the result outside if statement will be different in javascript [duplicate]

var b;

if(true){
  b = 3;
  function b(){}
  b = 1;
  console.log(b);
}

console.log(b);

Can you guys pls check why the second result of console.log(b) is 3 instead of 1?

Aucun commentaire:

Enregistrer un commentaire