fork download
  1. var a = [];
  2.  
  3. a[5] = 5;
  4. a[0] = 0;
  5. a['z'] = '70';
  6. a[3] = 3;
  7. a[2] = 2;
  8. a['8'] = '8';
  9. a[1] = 1;
  10. a[4] = 4;
  11.  
  12. print('foreach loop');
  13. for (var i in a) {
  14. print(a[i]);
  15. }
  16. print('foreach function');
  17. a.forEach(function(x) {
  18. print(x)
  19. });
Success #stdin #stdout 0.01s 4984KB
stdin
Standard input is empty
stdout
foreach loop
5
0
70
3
2
8
1
4
foreach function
0
1
2
3
4
5
8