Minor Cleanup: Use Cached slice Reference in app.listen Implementation
Description
While reviewing the application.js file, I noticed that Express defines:
var slice = Array.prototype.slice
but later in app.listen, it still uses the full property access:
var args = Array.prototype.slice.call(arguments)
This can be simplified to use the cached reference:
var args = slice.call(arguments)`
Expected Behavior
Use the already-defined slice reference for consistency and to avoid repeating
The behavior remains identical.
Actual Behavior
The code currently uses the direct prototype access instead of the cached reference.
Rationale
-
Improves consistency within the file
-
Avoids repeated long-form prototype access
-
Slight micro-optimization (cached function reference)
-
No behavioral changes
-
All tests continue to pass
Proposed Change
Replace:
var args = Array.prototype.slice.call(arguments)
with:
var args = slice.call(arguments)
I am happy to submit a pull request if maintainers consider this cleanup acceptable.