function fn(param){ setTimeout(function(){alert(param.author +": "+ param.msg);}, param.time); } fn({msg:"hola", author:"mr who", time:500});