For loop with chars as control variable - Javascript Statement

Javascript examples for Statement:for

Description

For loop with chars as control variable

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){//  w w w . j  a  va 2 s  .c  o m
for (var i = 'a'; i !== 'z'; i = nextChar(i)) {
    console.log(i.charCodeAt());
}
function nextChar(c) {
    return String.fromCharCode(c.charCodeAt(0) + 1);
}
    }

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

Related Tutorials