Check Different variable scoping using "let" keyword between browsers - Javascript DOM

Javascript examples for DOM:Key Event

Description

Check Different variable scoping using "let" keyword between browsers

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width"> 
   </head> 
   <body> 
      <script>
var obj = {/*from   www. j a v a2s.com*/
  key: 'val',
  key2: 'val'
};
function x(b) {
  setTimeout(b, 1000);
}
var keys = Object.keys(obj);
for (let ki of keys) {
  x(function() {
    console.log(ki); 
  });
}

      </script>  
   </body>
</html>

Related Tutorials