JSFiddle - React, Tailwind, and code Playground

by amatiasq

HTML

<script src="http://amatiasq.com/fiddle-console.js"></script>

JavaScript

function Point(x, y) {
    var key = x + '-' + y;
    if (!Point.cache[key])
        Point.cache[key] = Object.freeze({ x: x, y: y });
    return Point.cache[key];
}
Point.cache = {};


var a = Point(0, 0);
console.log('a.x', a.x);
a.x = 1;
console.log('a.x', a.x);


var b = Point(0, 0)
console.log('equality', a === b);