Comments (2)
Hi there,
It sounds to me like there is some kind of error in your code. Either you have misread an instruction, or made a typo. It is useful for me to explore what went wrong, as there is always scope for me to make my instructions clearer.
So, first of all, check your code against the finished version on our repo:
- https://github.com/mdn/learning-area/blob/master/javascript/oojs/advanced/oojs-class-inheritance-finished.html (source code)
- https://mdn.github.io/learning-area/javascript/oojs/advanced/oojs-class-inheritance-finished.html (live example)
I've tried running
Teacher.prototype = Object.create(Person.prototype);
in the console on this page, and it works as expected. Also, the functions are contained on the prototype inside properties, rather than being hung off the prototype directly, so you'll have more luck with Person.prototype.greeting
and Teacher.prototype.greeting
(no parentheses).
If you still have trouble, feel free to throw me your code source, and I'll have a look and see what the trouble is.
from learning-area.
I tried both the source code and live versions in Firefox and Chrome browsers. When I run:
Object.getOwnPropertyNames(Teacher.prototype);
I only see:
Array [ "constructor", "greeting" ]
But I can query all the function definitions when I make the calls without parenthesis. In retrospect, I guess it doesn't make sense to execute a function against its prototype, only on its instance. Tried this on teacher1 and everything worked fine.
Thanks for your help!
from learning-area.
Related Issues (20)
- Learning area
- Left sidebar doesn't show scrollbar at specific font sizes. HOT 1
- html/forms/html-form-structure/payment-form.html STYLING ISSUE HOT 3
- Guides > Tools and testing > Cross browser testing > Handling common HTML and CSS problems (Issue)
- [revise] fix payment form code snippet HOT 1
- [type="number"]
- Test your skills: Advanced HTML text — Task 2, paragraph 2: Copy discrepancy HOT 19
- Error Message is Cut Off at the Top when the Example is at the Bottom of the Browser Window HOT 10
- javascript/introduction-to-js-1/first-splash/number-guessing-game.html line 64 is different than any material covered by the tutorial HOT 4
- Standardize lang attribute usage in HTML tutorial on MDN to 'en-US' or 'en-us' HOT 3
- Auto-generated method stub
- Auto-generated method stub
- Width capped at 90% and height capped at 160px in javascript/building-blocks/tasks/styles.css HOT 3
- Label is covered by Text Area in learning-area/html/forms/your-first-HTML-form/first-form-styled.html
- My first issue HOT 1
- new day
- Site
- Where are my divs? HOT 4
- Java script
- .table-container not contained in .main-content
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from learning-area.