Function Scoped JavaScript Variables ACCESS on a 'NON Strict Mode '

function scoped() {
  var a = 150;
  let b = 300;
  const c = 500;

a = 300; // Why is it possible to access a function scoped variable?
b = 600; // Same as above
c = 1000; // Same as above and also why I can change value of constant?

console.log(a); // Return: 300 - Why it works?
console.log(b); // Return: 600 - Why it works?
console.log(c); // Return: 1000 - Why it works?


  1. Why it is possible (in a non strict mode) to access function scoped variables? Should this NOT be allowed?

  2. Why I can even change a value of a constant?

  3. How does scope or hoisting work behind the scene in this specific case?

118 thoughts on “Function Scoped JavaScript Variables ACCESS on a 'NON Strict Mode '”

  1. Hey I know this is off topic but I was wondering if you knew of any widgets I could add to my blog that automatically
    tweet my newest twitter updates. I’ve been looking for a plug-in like this for quite
    some time and was hoping maybe you would have some experience with something like this.
    Please let me know if you run into anything. I truly enjoy reading your
    blog and I look forward to your new updates.

  2. hey there and thank you for your info – I have definitely picked up anything new from right here.
    I did however expertise several technical issues using this site,
    since I experienced to reload the web site a lot of times previous to I could get it to load correctly.
    I had been wondering if your web hosting is OK? Not that
    I am complaining, but sluggish loading instances times will sometimes affect your placement in google and could damage your
    quality score if ads and marketing with Adwords.
    Well I’m adding this RSS to my email and can look out
    for much more of your respective fascinating content.
    Make sure you update this again soon.

  3. Pingback: viagra otc price

Leave a Comment