JSFiddle - React, Tailwind, and code Playground
HTML
<div id="console"></div>
CSS
#console {
background: #f4f4f4;
color: #444;
font-family: arial, sans-serif;
font-size: 14px;
line-height: 16px;
padding: 15px;
max-width: 400px;
}
JavaScript
var thenum = [5, 3, 678, 213];
function max(num){
return Math.max.apply(null, num);
}
document.getElementById('console').innerHTML = '<p>max([' + thenum.join(', ') + '])= ' + max(thenum) + ';</p>';
Array.prototype.max = function () {
return Math.max.apply(null, this);
};
document.getElementById('console').innerHTML += '<p>[' + thenum.join(', ') + '].max()= ' + thenum.max() + ';</p>';