gpt4 book ai didi

javascript - 如何从 for...of 循环返回值?

转载 作者:行者123 更新时间:2023-11-30 14:03:14 26 4
gpt4 key购买 nike

<分区>

如何从 for...of 循环返回值?

let years = [2000, 2001, 2002]


for(let [index, value] of years.entries()){
let age = new Date().getFullYear() - value;
return `user ${index + 1} age is ${age}`
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com