简体   繁体   中英

Javascript Lodash syntax error

For some reason I can't seem to find where by syntax error would be in this Lodash function. 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): 在此处输入图片说明

The particular position it is referring to (64:49) is after the class on the first line.

class is a keyword . Keywords cannot be used as variable names. Use a different name for the parameter.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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