JSFiddle - React, Tailwind, and code Playground

by pertrai1

JavaScript

function ball( type, grip, shape ) {
  this.type = type;
  this.grip = grip;
  this.shape = shape;
  this.caught = function( who,how ) {
    this.who = who;
    this.how = how;
  };
  ball.prototype.player = function() {
    console.log (this.who + "caught the ball" + this.how + "that was a" + this.type + "shaped like a " + this.shape + "thrown with a" + this.grip);
    };
};

var baseball = new ball("Mickey Mantle","sliding","baseball","circle","fastball");

console.log(baseball);