小编Rit*_*Das的帖子

有人可以将此箭头函数转换为普通函数吗?

我无法将此箭头函数转换为普通函数。我已经在 chrome 的控制台面板中对此进行了测试。此代码取自 freecodeCamp.org Es6 课程中的内容

//This is what I have tried. The final output result is showing undefined


const realNumberArray = [4, 5.6, -9.8, 3.14, 42, 6, 8.34, -2];
const squareList = function(arr) {
    "use strict";
    const squaredIntegers = function(num) {
        (function() {
            arr.filter(Number.isInteger(num) && num > 0);
        });       
        return squaredIntegers;
    } 
}

const squaredIntegers = squareList(realNumberArray);
console.log(squaredIntegers);

//Here is the Arrow function I was trying to convert

const realNumberArray = [4, 5.6, -9.8, 3.14, 42, 6, 8.34, -2]; …
Run Code Online (Sandbox Code Playgroud)

javascript web ecmascript-6 arrow-functions

1
推荐指数
1
解决办法
3790
查看次数

标签 统计

arrow-functions ×1

ecmascript-6 ×1

javascript ×1

web ×1