JSFiddle - React, Tailwind, and code Playground

by webinista

HTML

<div id="result"></div>

JavaScript

var arrNum = [1,2,3,4,5],
    r = document.getElementById('result'),
    
    double = function(n){
        return n * 2;      
    }, 
    /* this will be undefined because forEach calls a function once per item. */
    foo = arrNum.forEach( double );

r.innerHTML = foo;