I have some code like this:
for(var id=0; id < message.receiver.length; id++){ var tmp_id = id; zlib.gzip(JSON.stringify(message.json), function(err
@user24359 answer is a good solution but you can simply replace the var keyword by the let keyword.
var
let
for(var id=0;
becomes
for(let id=0;
See details here.
Edit : As Heriberto Juárez suggested it, it will only works for browsers that supports EcmaScript6.