Open Bug 1371716 Opened 3 years ago Updated 3 years ago

Syntax example provided is incomplete / incorrect

Categories

(Developer Documentation :: JavaScript, defect, P5)

All
Other
defect

Tracking

(Not tracked)

UNCONFIRMED

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
You need to log in before you can comment on or make changes to this bug.