AHinson
AHinson

Reputation: 661

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): enter image description here

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

Upvotes: 2

Views: 147

Answers (2)

Felix Kling
Felix Kling

Reputation: 816462

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

Upvotes: 5

Robsonsjre
Robsonsjre

Reputation: 1606

Try to use a different name for your function parameter, class is a reserved keyword :D

Upvotes: 1

Related Questions