以下代码的 ES5
等效项是什么?
Object.keys($location.search()).forEach( key => ($location.search()[key] == null || $location.search()[key] == "") && $location.search([key], null));
我尝试用简单的 =
替换 =>
,但这导致了错误。
如何将上述代码转换为 ES5
语法。
最佳答案
您可以自己将其转换为函数
或使用类似Babel的东西为你做
Object.keys($location.search()).forEach(function (key) {
return ($location.search()[key] == null || $location.search()[key] == "") && $location.search([key], null)
});
关于javascript - 将 ES6 箭头函数转换为 ES5 函数 JavaScript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44880082/