You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<h1><span class="secnum">2</span> Properties of the Array Prototype Object (<a href="https://tc39.es/ecma262/#sec-properties-of-the-array-prototype-object">22.1.3</a>)</h1>
<p><var>callbackfn</var> should be a function that accepts three arguments and returns a value that is coercible to the Boolean value <emu-val>true</emu-val> or <emu-val>false</emu-val>. <code>filterOut</code> calls <var>callbackfn</var> once for each element in the array, in ascending order, and constructs a new array of all the values for which <var>callbackfn</var> returns <emu-val>false</emu-val>. <var>callbackfn</var> is called only for elements of the array which actually exist; it is not called for missing elements of the array.</p>
1864
+
<p><var>callbackfn</var> should be a function that accepts three arguments and returns a value that is coercible to the Boolean value <emu-val>true</emu-val> or <emu-val>false</emu-val>. <code>filterReject</code> calls <var>callbackfn</var> once for each element in the array, in ascending order, and constructs a new array of all the values for which <var>callbackfn</var> returns <emu-val>false</emu-val>. <var>callbackfn</var> is called only for elements of the array which actually exist; it is not called for missing elements of the array.</p>
1865
1865
<p>If a <var>thisArg</var> parameter is provided, it will be used as the <emu-val>this</emu-val> value for each invocation of <var>callbackfn</var>. If it is not provided, <emu-val>undefined</emu-val> is used instead.</p>
1866
1866
<p><var>callbackfn</var> is called with three arguments: the value of the element, the index of the element, and the object being traversed.</p>
1867
-
<p><code>filterOut</code> does not directly mutate the object on which it is called but the object may be mutated by the calls to <var>callbackfn</var>.</p>
1868
-
<p>The range of elements processed by <code>filterOut</code> is set before the first call to <var>callbackfn</var>. Elements which are appended to the array after the call to <code>filterOut</code> begins will not be visited by <var>callbackfn</var>. If existing elements of the array are changed their value as passed to <var>callbackfn</var> will be the value at the time <code>filterOut</code> visits them; elements that are deleted after the call to <code>filterOut</code> begins and before being visited are not visited.</p>
1867
+
<p><code>filterReject</code> does not directly mutate the object on which it is called but the object may be mutated by the calls to <var>callbackfn</var>.</p>
1868
+
<p>The range of elements processed by <code>filterReject</code> is set before the first call to <var>callbackfn</var>. Elements which are appended to the array after the call to <code>filterReject</code> begins will not be visited by <var>callbackfn</var>. If existing elements of the array are changed their value as passed to <var>callbackfn</var> will be the value at the time <code>filterReject</code> visits them; elements that are deleted after the call to <code>filterReject</code> begins and before being visited are not visited.</p>
1869
1869
</div></emu-note>
1870
-
<p>When the <code>filterOut</code> method is called with one or two arguments, the following steps are taken:</p>
1870
+
<p>When the <code>filterReject</code> method is called with one or two arguments, the following steps are taken:</p>
1871
1871
<emu-alg><ol><li>Let <var>O</var> be ? <emu-xref aoid="ToObject" id="_ref_0"><a href="https://tc39.es/ecma262/#sec-toobject">ToObject</a></emu-xref>(<emu-val>this</emu-val> value).</li><li>Let <var>len</var> be ? <emu-xref aoid="LengthOfArrayLike" id="_ref_1"><a href="https://tc39.es/ecma262/#sec-lengthofarraylike">LengthOfArrayLike</a></emu-xref>(<var>O</var>).</li><li>If <emu-xref aoid="IsCallable" id="_ref_2"><a href="https://tc39.es/ecma262/#sec-iscallable">IsCallable</a></emu-xref>(<var>callbackfn</var>) is <emu-val>false</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Let <var>A</var> be ? <emu-xref aoid="ArraySpeciesCreate" id="_ref_3"><a href="https://tc39.es/ecma262/#sec-arrayspeciescreate">ArraySpeciesCreate</a></emu-xref>(<var>O</var>, 0).</li><li>Let <var>k</var> be 0.</li><li>Let <var>to</var> be 0.</li><li>Repeat, while <var>k</var> < <var>len</var><ol><li>Let <var>Pk</var> be ! <emu-xref aoid="ToString" id="_ref_4"><a href="https://tc39.es/ecma262/#sec-tostring">ToString</a></emu-xref>(<var>k</var>).</li><li>Let <var>kPresent</var> be ? <emu-xref aoid="HasProperty" id="_ref_5"><a href="https://tc39.es/ecma262/#sec-hasproperty">HasProperty</a></emu-xref>(<var>O</var>, <var>Pk</var>).</li><li>If <var>kPresent</var> is <emu-val>true</emu-val>, then<ol><li>Let <var>kValue</var> be ? <emu-xref aoid="Get" id="_ref_6"><a href="https://tc39.es/ecma262/#sec-get-o-p">Get</a></emu-xref>(<var>O</var>, <var>Pk</var>).</li><li>Let <var>rejected</var> be ! <emu-xref aoid="ToBoolean" id="_ref_7"><a href="https://tc39.es/ecma262/#sec-toboolean">ToBoolean</a></emu-xref>(? <emu-xref aoid="Call" id="_ref_8"><a href="https://tc39.es/ecma262/#sec-call">Call</a></emu-xref>(<var>callbackfn</var>, <var>thisArg</var>, « <var>kValue</var>, <var>k</var>, <var>O</var> »)).</li><li>If <var>rejected</var> is <emu-val>false</emu-val>, then<ol><li>Perform ? <emu-xref aoid="CreateDataPropertyOrThrow" id="_ref_9"><a href="https://tc39.es/ecma262/#sec-createdatapropertyorthrow">CreateDataPropertyOrThrow</a></emu-xref>(<var>A</var>, ! <emu-xref aoid="ToString" id="_ref_10"><a href="https://tc39.es/ecma262/#sec-tostring">ToString</a></emu-xref>(<var>to</var>), <var>kValue</var>).</li><li>Set <var>to</var> to <var>to</var> + 1.</li></ol></li></ol></li><li>Set <var>k</var> to <var>k</var> + 1.</li></ol></li><li>Return <var>A</var>.</li></ol></emu-alg>
<p>The <code>filterOut</code> function is intentionally generic; it does not require that its <emu-val>this</emu-val> value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method.</p>
1873
+
<p>The <code>filterReject</code> function is intentionally generic; it does not require that its <emu-val>this</emu-val> value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method.</p>
1874
1874
</div></emu-note>
1875
1875
</emu-clause>
1876
1876
</ins>
@@ -1912,4 +1912,4 @@ <h2>Software License</h2>
1912
1912
<p>THIS SOFTWARE IS PROVIDED BY THE ECMA INTERNATIONAL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ECMA INTERNATIONAL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</p>
<p>_callbackfn_ should be a function that accepts three arguments and returns a value that is coercible to the Boolean value *true* or *false*. `filterOut` calls _callbackfn_ once for each element in the array, in ascending order, and constructs a new array of all the values for which _callbackfn_ returns *false*. _callbackfn_ is called only for elements of the array which actually exist; it is not called for missing elements of the array.</p>
28
+
<p>_callbackfn_ should be a function that accepts three arguments and returns a value that is coercible to the Boolean value *true* or *false*. `filterReject` calls _callbackfn_ once for each element in the array, in ascending order, and constructs a new array of all the values for which _callbackfn_ returns *false*. _callbackfn_ is called only for elements of the array which actually exist; it is not called for missing elements of the array.</p>
29
29
<p>If a _thisArg_ parameter is provided, it will be used as the *this* value for each invocation of _callbackfn_. If it is not provided, *undefined* is used instead.</p>
30
30
<p>_callbackfn_ is called with three arguments: the value of the element, the index of the element, and the object being traversed.</p>
31
-
<p>`filterOut` does not directly mutate the object on which it is called but the object may be mutated by the calls to _callbackfn_.</p>
32
-
<p>The range of elements processed by `filterOut` is set before the first call to _callbackfn_. Elements which are appended to the array after the call to `filterOut` begins will not be visited by _callbackfn_. If existing elements of the array are changed their value as passed to _callbackfn_ will be the value at the time `filterOut` visits them; elements that are deleted after the call to `filterOut` begins and before being visited are not visited.</p>
31
+
<p>`filterReject` does not directly mutate the object on which it is called but the object may be mutated by the calls to _callbackfn_.</p>
32
+
<p>The range of elements processed by `filterReject` is set before the first call to _callbackfn_. Elements which are appended to the array after the call to `filterReject` begins will not be visited by _callbackfn_. If existing elements of the array are changed their value as passed to _callbackfn_ will be the value at the time `filterReject` visits them; elements that are deleted after the call to `filterReject` begins and before being visited are not visited.</p>
33
33
</emu-note>
34
-
<p>When the `filterOut` method is called with one or two arguments, the following steps are taken:</p>
34
+
<p>When the `filterReject` method is called with one or two arguments, the following steps are taken:</p>
<p>The `filterOut` function is intentionally generic; it does not require that its *this* value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method.</p>
55
+
<p>The `filterReject` function is intentionally generic; it does not require that its *this* value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method.</p>
0 commit comments