【问题标题】:can someone help me turn this arrow function to a regular function?有人可以帮我把这个箭头功能变成普通功能吗?
【发布时间】:2022-06-16 17:53:29
【问题描述】:

我在网上找到了这个箭头函数:

const myArray = [false, 24, "English", false, "english", 22, 19, false, "English", 19];

let countObject = myArray.reduce(function (
    count,
    currentValue
) {
    return (
        count[currentValue] ? ++count[currentValue] : (count[currentValue] = 1),
        count
    );
},
{});

我正在尝试理解箭头函数,所以我试图将它变成一个常规函数,但是当我尝试编写这个时,它不起作用。

有人可以帮我吗?

【问题讨论】:

  • 我在帖子中看不到任何箭头功能?
  • “不起作用”是什么意思?会发生什么,您预计会发生什么?
  • @Teemu 我觉得他的代码是把箭头函数转换成普通函数的结果
  • 对不起,我指的是函数的返回部分。

标签: javascript arrow-functions


猜你喜欢
  • 2017-12-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-02-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-06-07
相关资源
最近更新 更多