摘要:
const capitalize = str => str.charAt(0).toUpperCase() + str.slice(1) let result = capitalize("panda") // Panda console.log(result); 阅读全文
posted @ 2022-09-09 10:25
重庆熊猫
阅读(29)
评论(0)
推荐(0)
摘要:
const average = (...args) => args.reduce((a, b) => a + b) / args.length; let result = average(6, 5, 6, 7, 6); // 6 console.log(result); 阅读全文
posted @ 2022-09-09 10:21
重庆熊猫
阅读(45)
评论(0)
推荐(0)
摘要:
确定数字是奇数还是偶数 const isEven = num => num % 2 0; let result = isEven(996); console.log(result); 阅读全文
posted @ 2022-09-09 10:18
重庆熊猫
阅读(54)
评论(0)
推荐(0)
摘要:
//方式1: const merge = (a, b) => a.concat(b); //方式2: const merge = (a, b) => [...a,...b]; //测试 let result = merge(['panda','666'],['panda','666']); 阅读全文
posted @ 2022-09-09 10:17
重庆熊猫
阅读(27)
评论(0)
推荐(0)
摘要:
const removeDuplicates = (arr) => [...new Set(arr)]; console.log(removeDuplicates(['p', 'p', 'a', 'n', 'd', 'd', 'a', 6, 6, 6])); 阅读全文
posted @ 2022-09-09 10:14
重庆熊猫
阅读(24)
评论(0)
推荐(0)