Callback function on array of objects => error

A callback function is getting an error. It is cycling through an object of grades received in classes. For both the error is “Unexpected token ‘=>’ which leaves me thinking that I may not know how to write arrow functions.”
scores is meant to be a function that returns the scores from each class.
highGrades is intended to return scores that are above 95.
Calling each as a functtion with grades passed in did nothing.


I do not know if I have to put these functions in a higher order function for them to be callbacks. Console.log was tried in place of return.

var grades = {
  linearAlgebra : 90,
  chemistry : 95,
  biology :90,
  languages : 96
let scores = => {
  return grades["class"];
let highGrades = grades.filter(class =>  {
  return grades["class"] >= 95;

This example is from DelftStack. Filter Object in JavaScript | Delft Stack

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36 Edg/88.0.705.56.

Hi there,

class is a reserved word in JavaScript. When I replaced it with a different word, the arrow function error went away. Now you have a different error :wink:

Thanks. One problem is done.