📌  相关文章
📜  在编辑器中完成功能.它有一个参数:一个数组,.它必须遍历数组,对每个元素执行以下操作之一: - C 编程语言代码示例

📅  最后修改于: 2022-03-11 15:04:39.760000             🧑  作者: Mango

代码示例1
/*
 * Modify and return the array so that all even elements are doubled and all odd elements are tripled.
 * 
 * Parameter(s):
 * nums: An array of numbers.
 */
function modifyArray(nums) {
    return (nums || []).map(num => num * (num % 2 === 0 ? 2 : 3));