JSFiddle - React, Tailwind, and code Playground
by Ryan Morris
JavaScript
var me = {
name: "Ryan",
favoriteColor: "blue",
favoriteSaying: "uh...",
sayFavoriteSaying: function() {
console.log(this.name + " says: " + this.favoriteSaying);
},
trophies: [],
speak: function(msg) {
console.log(this.name + " says: " + msg);
}
};
me.speakTo = function(name, msg) {
// ability to say something to the other person
}
me.speak("Hello!");
me.trophies[me.trophies.length] = "Gold medal";
me.trophies[me.trophies.length] = "Person of the year";
// could use .push() instead...
me.trophies.push("Super Star");
// this was my actual first trophy!
me.trophies.unshift("Cutest baby award");
console.log(me.trophies);