JSFiddle - React, Tailwind, and code Playground

by Sahin Deniz

JavaScript

let a = [1, 2, 3, 4];

/*a.forEach((b,d) => {
  console.log(b,d);
  let c = a.shift();
  console.log(c);
});*/
let c;
/*do {
  c = a.shift();
  console.log(c);
} while (c);*/

while (c = a.shift()) {
  console.log(c);
}