JSFiddle - React, Tailwind, and code Playground

by scheda

Babel + JSX

const keys = ['apple', 'banana', 'orange'];
let fruits = [];

keys.forEach(x => fruits[x] = `${x} is a fruit`);

// now we have fruits.apple, fruits.banana, fruits.orange
// Since it's now an object you'll need to get the keys and iterate over that

const fruit_keys = Object.keys(fruits);
fruit_keys.forEach(x => console.log(fruits[x]));