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 mobileLib = { init: function () { this.screenwidth = "320px"; this.render(); this.utli(); }, render: function () { $('#container').css("width", this.screenwidth).html("Mobile Render"); } }; $(document).ready(function () { mobileJS = $.extend(true, Core, mobileLib); mobileJS.init(); });
<div id="container"></div>