JSFiddle - React, Tailwind, and code Playground

by Yurii Predborskyi

JavaScript

function processArray(arr) {
  let charges = [];
  if (!Array.isArray(arr)) return charges;
  for (let item of arr) {
    charges.push('woot' + item);
  }
  return charges;
}

let test = ['cool'];
test.push(...processArray());
document.write(test);