You can use map function of array to get the new resultant array according to the operation performed for each element in the array
var arr = ["the", "quick", "brown", "fox"];
console.log(arr);
const resultArray = arr.map((element) => {
return element.length;
});
console.log(resultArray);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…