JSFiddle - React, Tailwind, and code Playground
JavaScript
let MyArray = function(a) {
if (typeof a !== "object" && !!a.length) {
throw Error('Argument should be an array');
}
this.nums = a;
return this;
}
MyArray.prototype.toString = function() {
return this.nums.join(' :: ');
}
let a = new MyArray(['asdfasdf',1,2,3,4]);
console.log(a.length);
console.log(a.toString());
console.log(a.numbs.toString());