JSFiddle - React, Tailwind, and code Playground

by hfougere

HTML

<div id="data"></div>

Babel + JSX

// map
var array1 = [1, 4, 9, 16];
const map1 = array1.map(x => x * 2);


//every
function isBelowThreshold(currentValue) {
  return currentValue < 40;
}
var array1 = [1, 30, 39, 29, 10, 13];

//some
var array = [1, 2, 3, 4, 5];
var even = function(element) {
  // checks whether an element is even
  return element % 2 === 0;
};

//add to front
var array1 = [1, 2, 3];
console.log(array1.unshift(4, 5)); // expected output: 5 (length)
console.log(array1); // expected output: Array [4, 5, 1, 2, 3]

// for each
var array1 = ['a', 'b', 'c'];
array1.forEach(function(element, i) {
  console.log(element, i);
});