Closed Bug 1371716 Opened 7 years ago Closed 4 years ago

Syntax example provided is incomplete / incorrect

Categories

(Developer Documentation Graveyard :: JavaScript, defect, P5)

All
Other
defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: makeshithappen, Unassigned)

References

()

Details

:: Developer Documentation Request

      Request Type: Correction
     Gecko Version: 53 Branch
 Technical Contact: 

:: Details

Syntax
var newArray = arr.filter(callback[, thisArg])

Parameters described in the following section include callback, element, index, array, and thisArg. As you can see, the syntax example only shows callback and thisArg. If you look at another array prototype, such as Array.prototype.map, you will see the syntax is much more complete with all the parts included. 

var new_array = arr.map(function callback(currentValue, index, array) {
    // Return element for new_array
}[, thisArg])
element, index, and array are parameters for callback function.
I guess it needs explicit example like `callback = function(element, index, array) {...}` tho
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: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.