Override Inherited Methods Question

I continually get an error on my local PC when attempting to update the prototype explicitly. However, the same language passes the FCC test for “OOP: Override Inherited Methods”.
Javascript seems very happy to do the prototype work implicitly when the prototype keyword is removed, as below:

class User {
    constructor(userName, password) {
        this.userName = userName;
        this.password = password;
    speak() {
        return "Hello there!"

var user1 = Object.create(User.prototype);

var myUser = Object.create(User.prototype);
myUser.userName = "kevin";
myUser.password = "password";

// no prototype required here
myUser.speak = function() {
    return "talking...";


Am I doing something wrong, or is this simply ES6 syntactic sugar?

1 Like

I’m not exactly sure what you’re asking. You aren’t updating the prototype here. The prototype is unchanged. You are updating the speak() function for a single instance of a User object.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.