JSFiddle - React, Tailwind, and code Playground
JavaScript
var Model = function() {
this.names = ["name1", "name2"];
}
Model.prototype.init = function(item_name) {
this.names[0] = item_name;
}
var Item = new Model();
Item.init("New Name"); // ERROR: Cannot set property '0' of undefined
console.log(i);