Comments (3)
@drsm Can you, please, give me the link to the specification which requires this behavior for every function?
from njs.
@xeioex i'll try to find out. but, i think it is a "common behavior", rather than requirement. my point is that if no special care has been taken to differentiate a call without an argument specified and a call with undefined(void) argument provided, then results of both calls should be the same. otherwise there will be inconsistencies between internal and user-defined functions.
>> function id(x) { return x; }
undefined
>> id() === id(void 0)
true
>> (function wrapfail(x) { return 2..toString(x); })()
RangeError
at Number.prototype.toString (native)
at anonymous (:1)
at main (native)
also, if we want to implement the "default function parameters" feature, let's consider this sample:
> function defaults(x = 10) { return x; }
undefined
> defaults() === defaults(void 0)
true
and finally, all of [V8, Firefox, JJS] engines demonstrate the same behavior.
from njs.
here it is:
https://www.ecma-international.org/ecma-262/5.1/#sec-10.5
4.d.ii If n is greater than argCount, let v be undefined otherwise let v be the value of the nβth element of args.
from njs.
Related Issues (20)
- Access ssl connection HOT 2
- Will shared-memory/ Redis cache be implemented or considered using njs HOT 1
- How to send a header defined in an NJS function to the receiver. HOT 2
- Failure to build with openssl 1.1.0l HOT 5
- Profile JS code HOT 2
- Host headers no longer allowed in fetch HOT 8
- NJS node modules for protobufjs thrown RangeError: invalid index HOT 1
- eIDAS and ecstatement HOT 4
- Improve error message for js_import
- js_preload_object stores non-native Array HOT 5
- FAIL: njs not compiling as documented HOT 2
- Internal Redirect does NOT work within `js_body_filter` HOT 3
- SEGV in njs_scope_value HOT 1
- When copying "location" header of a subrequest, response body of the subrequest is copied into it as well HOT 7
- Implement Map and Set objects (ES6)
- [question] has anyone be able to install ngx-module-njs on ubi8 HOT 3
- Add support for Error.cause (ES2022)
- NJS Fetch() always adds text/plain;charset=utf-8 to any Content-Type header HOT 7
- njs-0.7.12 fails to build with gcc-13 HOT 2
- Where is the x509.js file located?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from njs.