JSFiddle - React, Tailwind, and code Playground
by Darby Rathbone
JavaScript
var pShape = {
verts : [],
vertex : function(){
var args = {toString:function(){return args.type+":"+args.vert;},
type: 'vertex',
vert:[].splice.call(arguments,0)};
this.verts.push(args);
},
curve : function(){
var args = {toString:function(){return args.type+":"+args.vert;},
type: 'curve',
vert:[].splice.call(arguments,0)};
this.verts.push(args);
},
bezier : function(){
var args = {toString:function(){return args.type+":"+args.vert;},
type: 'bezier',
vert:[].splice.call(arguments,0)};
this.verts.push(args);
}
};
var a = Object.create( pShape);
a.vertex(1,2);
a.bezier(1,2,2,3,3,4);
console.log(a.verts+'');