简体   繁体   English

Javascript Lodash语法错误

[英]Javascript Lodash syntax error

For some reason I can't seem to find where by syntax error would be in this Lodash function. 由于某种原因,我似乎找不到此Lodash函数的语法错误所在的位置。 Does anyone know where I'm going wrong here? 有人知道我在哪里错吗?

const classes = _.filter(state.classes, class => {
  return class.date === moment()
});

Here is the error I'm seeing (using React Native): 这是我看到的错误(使用React Native): 在此处输入图片说明

The particular position it is referring to (64:49) is after the class on the first line. 它所指的特定位置(64:49)在第一行的class之后。

class is a keyword . class是一个关键字 Keywords cannot be used as variable names. 关键字不能用作变量名。 Use a different name for the parameter. 为参数使用其他名称。

尝试为函数参数使用其他名称, class是保留关键字:D

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM