Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Looking back on JavaScript

linyows
April 27, 2017

Looking back on JavaScript

GMO pepabo Tech Meeting/Hosting#3 で話した資料です

linyows

April 27, 2017
Tweet

More Decks by linyows

Other Decks in Technology

Transcript

  1. ܧঝͷྫ function Employee() { this.name = ""; this.dept = "general";

    } function Manager() { Employee.call(this); this.reports = []; } Manager.prototype = Object.create(Employee.prototype); function Worker() { Employee.call(this); this.projects = []; } Worker.prototype = Object.create(Employee.prototype); function Engineer() { Partner.call(this); this.dept = "engineering"; } Engineer.prototype = Object.create(Worker.prototype); var opo = new Engineer(); opo.dept; // => "enginneering"
  2. ֦ுͷྫ function Point(x, y) { this.x = x; this.y =

    y; } var p = new Point(3, 4); p.x // => 3 p.y // => 4 Point.prototype.r = function() { return Math.sqrt((this.x * this.x) + (this.y * this.y)); }; p.r();
  3.