JSFiddle - React, Tailwind, and code Playground

by adelura

JavaScript

var square = {
    x: 5,
    y: 10
};

square.getField = function() {
    return this.x * square.y;
};

square.getPerimeter = function() {
    return 2 * this.x + 2 * this.y;
};

console.log( square.getField() );
console.log( square.getPerimeter() );