法典:
const temp = [27, 28, 30, 40, 42, 35, 30];
let high = temp.findLast(x => x > 40);
页: 1 每个要素中包含7项内容,其类型数值为:
In the second line there is the creation of a variable that will later receive a single number that is the result of the following code sentence temp.findLast(x => x > 40)
;
temp.findLast()
will traverse the temp
array in reverse order
(starting from 30, 35... up to 27) and will return the first element
tested that satisfy the true
condition of the callback x => x > 40
passed by parameter;
a) 如果在阵列开始时增加一个价值45的元件,你就会看到,<代码>高代码>将保持42个,因为有42个是“顶”()”第1个元件,由“呼号”回来。
b) The iteration of the findLast function is interrupted as soon as it receives the first number greater than or equal to 40 in reverse order, that is, there will no longer be any processing resources being used;
c) 如无<代码>true > 状况由questback退回,这意味着find Last(x =>x > 40)
将完全通过<代码>temp阵列,并将返回un specified
。 页: 1
文件:https://developer.mozilla.org/en-US/docs/Web/Java/Reference/Global_Objects/Array/findLast