JSFiddle - React, Tailwind, and code Playground

by 1eddy87

JavaScript

for (var i = 0; i <= 5; i++) {
  console.log(i);
  //0 1 2 3 4 5 6 7 8 9 10
  if (i == 5) {
    testForOne();
  }
}

function testForOne() {
  var my_array = ['a', 'b', 'c'];
  for (var i = 0; i < my_array.length; i++) {
    console.log(my_array[i]);
    //a b c
    if (i == my_array.length - 1) {
      testForTwo();
    }
  }
}

function testForTwo() {
  var my_array = ['d', 'e', 'f'];
  var i = 0;
  my_array.forEach(function(current_value) {
    console.log(current_value);
    //d e f
    i++
    if (i == my_array.length) {
      console.log('Done')
    }
  });
}