Till now I was expecting that there in no block level scope in Javascript. But after reading this article I came to know that block-scoped variables are introduced in javascript. Although this article <Everything you need to know about Javascript variable scope > has a very good explaination about the javascript variable scope, I am still wondering the list of browsers and their versions where we can start using block-scoped variables.
It would be great if you could add to the information about block-scope variable in javascript.

Recommended Answers

All 3 Replies

Member Avatar for iamthwee

came to know that block-scoped variables are introduced in javascript

If they have just been introduced sounds like you could be playing a game of Russian Roulette with your internet browsers.

Better to be safe and ignore them.

Or use jquery.

As I understand it, the ECMAScript that is the backbone of JavaScript is pretty standard among most major browsers. The type of scoping youre talking about should be pretty consistent from IE8+ (probably IE6 and 7), as well as all other flavors you will encounter.

The only way you will know for sure if you are having issues is to come across them. For the most part, Mozilla has been good about providing shims to "fix" broken code in older browsers, so when you come across something "broken" just google it and you will most likely find your solution.

IE 11 supoorts block scope statements

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.