Closed Bug 1275816 Opened 5 years ago Closed 5 months ago
Explain how |this| value is calculated in call expression, and the difference between `foo[prop]()` and `func = foo[prop], func()`
|var eArr = arr[Symbol.iterator]();| and |var arrIteratorFunction = arr[Symbol.iterator]; var eArr = arrIteratorFunction();| are different things, in term of |this| value. with |foo[prop]()| expression, |foo[prop]| function is called with |this == foo| with |func = foo[prop], func()| expressions, |foo[prop]| function is called with |this == undefined| then, Array.prototype[@@iterator] iterates over |this| value. so, in latter case, it throws an error while converting |this| to object, as it's |undefined|. https://tc39.github.io/ecma262/#sec-array.prototype-@@iterator https://tc39.github.io/ecma262/#sec-array.prototype.values So, I think this bug is basically INVALID, but can you tell me why do you think those code are same? if there is something that can be improved/fixed in the document, it would be nice to know :)
Thank you :) fscholz, can I have your opinion about documentation on |this| value in function call  with member expression ? I guess, it would be nice to explain how "Reference"  is generated , how |this| is extracted from it , and how/where it's converted into a value  there, without stepping into it too much.  https://tc39.github.io/ecma262/#sec-function-calls  https://tc39.github.io/ecma262/#sec-property-accessors-runtime-semantics-evaluation  https://tc39.github.io/ecma262/#sec-reference-specification-type  https://tc39.github.io/ecma262/#sec-getthisvalue  https://tc39.github.io/ecma262/#sec-getvalue
Flags: needinfo? → needinfo?(fscholz)
Product: Core → Developer Documentation
Version: 46 Branch → unspecified
Summary: array[Symbol.iterator] doesn't evaluate to an iterator function → Explain how |this| value is calculated in call expression, and the difference between `foo[prop]()` and `func = foo[prop], func()`
Status: UNCONFIRMED → NEW
Ever confirmed: true
MDN Web Docs' bug reporting has now moved to GitHub. From now on, please file content bugs at https://github.com/mdn/sprints/issues/ and platform bugs at https://github.com/mdn/kuma/issues/.
Status: NEW → RESOLVED
Closed: 5 months ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.