JavaScript: object and prototype, part0.1

Self-tutoring about JavaScript: the tutor continues about objects and the prototype connection.

It’s my understanding that in “old” JavaScript, you could have objects but they were defined using a constructor function, such as

function theObj(the_name){;

var myObj=new theObj(‘Smedley’);

The object above has no methods yet, but we could define one on its prototype (see my post here), as follows:


console.log(“My name is “”.”);

Now, we can invoke the tellAboutMe method on myObj:


Then we should receive the output My name is Smedley.

The word class didn’t reach JavaScript until 2015. However, the new keyword was always part of it. That’s how I understand it, anyhow.


Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

Leave a Reply