JSFiddle - React, Tailwind, and code Playground
JavaScript
// Are these two patterns the same performance/memory-wise
function MyConstructor() {
function someMethod() {
console.log('foo');
}
}
var instanceA = new MyConstructor();
function OtherConstructor() {}
OtherConstructor.prototype = {
someMethod: function () {
console.log('foo');
}
}
var instanceB = new OtherConstructor();