JSFiddle - React, Tailwind, and code Playground
JavaScript
function TabModel() {
this.href = null;
}
TabModel.prototype.onTitleClick = function() {
if (this.href) {
console.log('Opening ' + this.href);
} else {
console.log('No href ');
}
};
function PageModel() {
this.tab = new TabModel();
}
var model = new PageModel();
var serverResponse = { tab: { href: 'http://jquery.com' } };
$.extend(model, serverResponse);
console.log(model.tab.onTitleClick ? 'PASS' : 'FAIL');