A method in the constructor becomes an own property of every instance.
Acceptance criteria
- 1.#out should show just name.
A method in the constructor becomes an own property of every instance.
class Person { constructor(name) { this.name = name; this.greet = function () { return "hi"; }; } } const keys = Object.keys(new Person("Ada")); document.querySelector('#out').textContent = keys.length === 1 ? "just name" : "also carries " + (keys.length - 1) + " method";
Output ready when you are
Press Run to render your code, or Submit to validate your solution.