jlittlejohn
5/1/2019 - 4:27 PM

JS: For Loop Example

JS: For Loop Example

var anArray = [true, false, false, true, true, false];
var trueArray = [];
var falseArray = [];

for (i = 0; i < anArray.length; i++) {
  if (anArray[i] === true) {
    trueArray.push(anArray[i]);
  } else {
    falseArray.push(anArray[i]);
  }
}