SUW15 – v44 – Snabb repetition av en JavaScript class


class Me { construct(props) { for (var i in props) { this[i] = props[i]; } } speak() { console.log("Hello"); for (var i in this) { if (typeof this[i] == "function") { continue; } console.log("My " + i + " is " + this[i]); } } } var aMe = new Me({name: "Hugo", "email": "hugo@nodebite.se", height: 180}); aMe.speak();
0 votes