var theItem = null; var replaceItem = function () { theItem = { longStr: new Array(1000000).join('*'), someMethod: function () { console.log(someMessage); } }; }; setInterval(replaceItem, 1000);