JSFiddle - React, Tailwind, and code Playground

by nsshrinivasan

HTML

<div id="music"></div>

JavaScript

var arr = [12, 13, 19];

//implementation of custom $.each loop using plain old javascript
//watch the console.log for results.

function callback(val){
    //console.log(val);
    $("#music").append('<div>'+val+'</div>');
    
}            
 
var forEach = function(callback){
    for(var i=0; i < arr.length; i++){
           callback.call(this, arr[i]);
    }
 }
    
forEach(callback);
//$("#music").html(''); //erases the html contents