jquery - How to extend javascript class in ECMA5(IE11) ? -
ie11 not support ecma script 6. cannot use "class" syntax in ie11. then,how extend obj in ie11(ecma5) ?
//only ecma6+ // not work in ie11 class childobj extends google.maps.latlng { constructor(child) { super(number(child.lat), number(child.lng)); this.additionalprop = child; } } //ecma5 -> ???? i not know correct way define child class, e.g. childobj shown above ,in ecma5.
i think jquery $.extend not extending , merging properties. , how call parent class constructor in child class?
according mdn doc, do:
function childobj() { google.maps.latlng.call(this); } childobj.prototype = object.create(google.maps.latlng.prototype); childobj.prototype.constructor = rectangle; but simpler solution if want use es6 components still have es5 code, use transpiler. example babel trick.
Comments
Post a Comment