题解 | #计数#
计数
http://www.nowcoder.com/practice/628339bd8e6e440590ad86caa7ac6849
// 描述
// 统计数组 arr 中值等于 item 的元素出现的次数
// 示例1
// 输入:
// [1, 2, 4, 4, 3, 4, 3], 4
// 复制
// 输出:
// 3
function count(arr, item) {
return arr.filter((i)=>i==item).length
}计数
http://www.nowcoder.com/practice/628339bd8e6e440590ad86caa7ac6849
// 描述
// 统计数组 arr 中值等于 item 的元素出现的次数
// 示例1
// 输入:
// [1, 2, 4, 4, 3, 4, 3], 4
// 复制
// 输出:
// 3
function count(arr, item) {
return arr.filter((i)=>i==item).length
}相关推荐
只想搞钱的鸽子很喜欢...:混账是很多的,还有那些在自己风华正茂的年纪说风凉话讥讽那些下岗前员工的。这些人都是现在职场环境这么烂的帮凶