JSFiddle - React, Tailwind, and code Playground

JavaScript

Object.prototype.clone = function () {
    if (this instanceof Array) return this.slice(0);
    var newObj = {};
    for (var i in this) {
        if (i == 'clone') continue;
        if (this[i] && typeof this[i] == "object") {
            newObj[i] = this[i].clone();
        } else newObj[i] = this[i];
    }
    return newObj;
};

var o = {
    myMeth: function () {
        return 'nothing';
    },
    obj: {
        nested: {
            f: 'a'
        }
    }
},
a = [2, 3, 4, 5, 6],
    b = a.clone();
b[0] = "a";

alert(a);
alert(b);