var Core = { screenwidth: "1024px", init: function () { this.render(); }, render: function () { $('#container').css("width", this.screenwidth).html("Default Render Function"); }, utli: function () { $('#container').append("<p>Core utility function Called</p>"); }, }; var desktopLib = { init: function () { this.screenwidth = "600px"; this.render(); this.utli(); }, render: function () { $('#container').css("width", this.screenwidth).html("Desktop Render"); } }; $(document).ready(function () { desktopJS = $.extend(true, Core, desktopLib); desktopJS.init(); });
<div id="container"></div>