Skip to content

Instantly share code, notes, and snippets.

@pimvdb
pimvdb / freeze_closure.js
Created February 25, 2012 12:22
Freeze variable in closure
function freeze() {
var args = Array.prototype.slice.call(arguments);
return args.pop().apply(this, args);
}
// test1.js
var net = require('net');
var server = net.createServer(function(socket) {
socket.addListener("data", function(data) {
console.log(data.toString())
});
});