diff --git a/lib/net.js b/lib/net.js index ad799567b094c1..ca220e4725aaa6 100644 --- a/lib/net.js +++ b/lib/net.js @@ -60,9 +60,8 @@ exports.createServer = function(options, connectionListener) { // connect(path, [cb]); // exports.connect = exports.createConnection = function() { - const argsLen = arguments.length; - var args = new Array(argsLen); - for (var i = 0; i < argsLen; i++) + var args = new Array(arguments.length); + for (var i = 0; i < arguments.length; i++) args[i] = arguments[i]; args = normalizeConnectArgs(args); debug('createConnection', args); @@ -885,9 +884,8 @@ Socket.prototype.connect = function(options, cb) { // Old API: // connect(port, [host], [cb]) // connect(path, [cb]); - const argsLen = arguments.length; - var args = new Array(argsLen); - for (var i = 0; i < argsLen; i++) + var args = new Array(arguments.length); + for (var i = 0; i < arguments.length; i++) args[i] = arguments[i]; args = normalizeConnectArgs(args); return Socket.prototype.connect.apply(this, args);