JSFiddle - React, Tailwind, and code Playground

by Elijah Manor

HTML

<script src="https://getfirebug.com/firebug-lite-debug.js"></script>

JavaScript

//Object Literal declaring properties and methods
var skillet = {
    //public property
    ingredient: "Bacon Strips",
    
    //public method
    fry: function() {
        console.log( "Frying " + this.ingredient );
    }
};
console.log( skillet.ingredient ); //Bacon Strips
skillet.fry(); //Frying Bacon Strips

//Adding a public property to an Object Literal
skillet.quantity = "12";
console.log( skillet.quantity ); //12

//Adding a public method to an Object Literal
skillet.toString = function() {
    console.log( this.quantity + " " + 
                 this.ingredient );
};
skillet.toString(); //12 Bacon Strips