While many people refer to classes in JavaScript, the fact is that JavaScript is not class based and does not have classes. It is a Prototypical language, where all objects inherit from a prototype object (not class).
Additionally, your examples are commented to say that properties/menthods would go into the object constructors, but only your fist example does that. The second two show declaring methods outside of the constructor.
You forgot the litteral way, the JSON way of writing objects, which the lightest way
selectoNET 2 months ago
While many people refer to classes in JavaScript, the fact is that JavaScript is not class based and does not have classes. It is a Prototypical language, where all objects inherit from a prototype object (not class).
Additionally, your examples are commented to say that properties/menthods would go into the object constructors, but only your fist example does that. The second two show declaring methods outside of the constructor.
TechTrainSolutions 3 months ago
nice
pjtechy 9 months ago
prototype is not a function/method of javascript. it's an object.
kelvin0yt 10 months ago
@kelvin0yt ya, your probably right, I'm not 100% good with all the terms and stuff, I"m writing these tutorials while I'm learning myself.
FreeWebTutorialsRock 10 months ago
nice
iadrian20 10 months ago
Is JavaScript actually a Object oriented programming language?
breakingthebeat 1 year ago
@breakingthebeat yes, (almost) everything is a object
jeromsavestheworld 10 months ago