JSFiddle - React, Tailwind, and code Playground

HTML

<div id="nums"></div>

JavaScript

nums = [1,2,'привет'];

Array.prototype.sum = function() {
    total = 0;
    for (i=0;i<this.length;i++) {
        total += this[i];
    }
    return total;
}

document.getElementById("nums").innerHTML = nums.sum();