Function - Rename properties and methods to include prototype#18200
Conversation
files/en-us/web/javascript/reference/global_objects/function/tostring/index.md
Outdated
Show resolved
Hide resolved
files/en-us/web/javascript/reference/global_objects/function/arguments/index.md
Outdated
Show resolved
Hide resolved
files/en-us/web/javascript/reference/global_objects/function/call/index.md
Outdated
Show resolved
Hide resolved
Josh-Cena
left a comment
There was a problem hiding this comment.
Overall looks much better to me; mostly minor suggestions
files/en-us/web/javascript/reference/global_objects/function/apply/index.md
Outdated
Show resolved
Hide resolved
files/en-us/web/javascript/reference/global_objects/function/apply/index.md
Outdated
Show resolved
Hide resolved
files/en-us/web/javascript/reference/global_objects/function/apply/index.md
Outdated
Show resolved
Hide resolved
files/en-us/web/javascript/reference/global_objects/function/apply/index.md
Outdated
Show resolved
Hide resolved
| `apply` is very similar to `call()`, except for the type of arguments it supports. You use an arguments array instead of a list of arguments (parameters). With `apply`, you can also use an array literal, for example, `func.apply(this, ['eat', 'bananas'])`, or an {{jsxref("Array")}} object, for example, `func.apply(this, new Array('eat', 'bananas'))`. | ||
|
|
||
| You can also use {{jsxref("Functions/arguments", "arguments")}} for the `argsArray` parameter. {{jsxref("Functions/arguments", "arguments")}} is a local variable of a function. It can be used for all unspecified arguments of the called object. Thus, you do not have to know the arguments of the called object when you use the `apply` method. You can use `arguments` to pass all the arguments to the called object. The called object is then responsible for handling the arguments. | ||
| You can also use {{jsxref("Functions/arguments", "arguments")}} for the `argsArray` parameter. `arguments` is a local variable of a function. It can be used for all unspecified arguments of the called object. Thus, you do not have to know the arguments of the called object when you use the `apply` method. You can use `arguments` to pass all the arguments to the called object. The called object is then responsible for handling the arguments. |
There was a problem hiding this comment.
Frankly, I don't grasp this paragraph. Is it talking about something like this?
function foo() {
bar.apply(null, arguments);
}Maybe we can merge it with the paragraph below about array-like objects, saying something like "arguments is array-like so you can pipe it through—this is equivalent to using function foo(...args) { bar(...args) }?
There was a problem hiding this comment.
Yes, it seems to be redundant in that it describes being array-like, without saying "array-like."
files/en-us/web/javascript/reference/global_objects/function/displayname/index.md
Outdated
Show resolved
Hide resolved
files/en-us/web/javascript/reference/global_objects/function/function/index.md
Outdated
Show resolved
Hide resolved
files/en-us/web/javascript/reference/global_objects/function/length/index.md
Outdated
Show resolved
Hide resolved
files/en-us/web/javascript/reference/global_objects/function/length/index.md
Outdated
Show resolved
Hide resolved
files/en-us/web/javascript/reference/global_objects/function/name/index.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Joshua Chen <[email protected]>
…pply/index.md Co-authored-by: Joshua Chen <[email protected]>
Co-authored-by: Joshua Chen <[email protected]>
…ame/index.md Co-authored-by: Joshua Chen <[email protected]>
Co-authored-by: Joshua Chen <[email protected]>
|
@Josh-Cena I'm still reviewing your feedback, but just to confirm, it seems like you're interested in broadening this to a light rewrite/update of Function/*? |
|
No—I'm just dropping random thoughts as I go through the diff. I'm not particularly interested in re-writing outside the diff. |
|
Understood, it's just that there are definitely plenty of similar issues outside of the diff. |
| bind(thisArg, arg1) | ||
| bind(thisArg, arg1, arg2) | ||
| bind(thisArg, arg1, ... , argN) | ||
| bind(thisArg, arg1, …, argN) |
There was a problem hiding this comment.
@phosra why did you change these?
As per the MDN Web Docs guidelines, https://developer.mozilla.org/en-US/docs/MDN/Structures/Syntax_sections#syntax_for_arbitrary_number_of_parameters , it's correct. Including the ellipsis.
We updated all the pages as per these guidelines couple of month ago.
There was a problem hiding this comment.
Oh @OnkarRuikar I wasn't aware of that convention ^^ If you want to send a quick fix I will gladly review it.
| call(thisArg, arg1) | ||
| call(thisArg, arg1, arg2) | ||
| call(thisArg, arg1, ... , argN) | ||
| call(thisArg, arg1, …, argN) |
There was a problem hiding this comment.
call(thisArg, arg1, /* … ,*/ argN)
Summary
Renames properties such as
Function.nametoFunction.prototype.name.Motivation
Consistency.
Supporting details
N/A.
Related issues
Fixes #18188.
Metadata