JSFiddle - React, Tailwind, and code Playground
JavaScript
function Ball(color, radius, hasPolkaDots) {
this.ballColor = color;
this.ballRadius = radius;
this.doesThisBallhavePolkaDots = hasPolkaDots;
};
Ball.prototype.bounce = function() {
console.log("currently bouncing");
};
var ball1 = new Ball("Purple", 12, true);
var ball2 = new Ball("Blue", 5, false);
console.log(ball1.ballColor); //Purple"
console.log(ball2.ballRadius); //5
console.log(ball2.doesThisBallhavePolkaDots); //false
ball1.bounce(); // "Booiiiiinng. Ball is bouncing"
ball2.bounce(); // "Booiiiiinng. Ball is bouncing"