scrimba
Learn Modern JavaScript
Use class Syntax to Define a Constructor Function
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Use class Syntax to Define a Constructor Function
AboutCommentsNotes
Use class Syntax to Define a Constructor Function
Expand for more info
index.js
run
preview
console
var SpaceShuttle = function(targetPlanet){
this.targetPlanet = targetPlanet;
}
var zeus = new SpaceShuttle('Jupiter');

console.log(zeus.targetPlanet)



// function makeClass() {

// return Vegetable;
// }
// const Vegetable = makeClass();
// const carrot = new Vegetable('carrot');
// console.log(carrot.name);
Console
"Jupiter"
,
index.html
-2:10