BrU32

JS Get Ammount Of Numbers/Chars in Str SRC

Jul 13th, 2016
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. <script>
  2. function spaceOutStr(Stringy){
  3. var p=Stringy
  4. for(var i=0;i<p.length;i++){
  5. var out=p.substring(i,i+1);
  6. if(i%2){
  7. document.write(out+'even<br>');
  8. }else{
  9. document.write(out+'odd<br>');
  10. }
  11. }
  12. }
  13. </script>
  14. <body onload="spaceOutStr('123456789');">
Add Comment
Please, Sign In to add comment