Javascript: stuck with comparison function

I am stuck and need help finishing this fetch request. I need a function to check if the movie (a single object) in the request has previously been rated by the user.

The ratings are in the ratedMovies array. If the movie was rated I need the userRating property with it’s value to be added to the response. If it has not been rated, I need the userRating value to be null

 const ratedMovies = useStore((state) => state.ratedMovies)

  const getMovieDetails = () => {
    const key = `${movie.imdbID}&apikey=b46dc190`
      .then((response) => {

       // Here a comparison is required, to check if the movie in the response (a single object)
       // has ever been rated before and its ID (imdbID) and userRating (property to be added) is        
       // present in the ratedMovies array
       // if it is present I need the property userRating nad it's value to be added to the response
       // or when it is empty, to have the userRating be null

      .then((response) => {
      .catch((error) => console.log(error))

Sample axios response:

    "Title": "Star Wars: Episode V - The Empire Strikes Back",
    "Year": "1980",
    "Rated": "PG",
    "Released": "20 Jun 1980",
    "Runtime": "124 min",
    "Genre": "Action, Adventure, Fantasy",
    "Director": "Irvin Kershner",
    "Writer": "Leigh Brackett, Lawrence Kasdan, George Lucas",
    "Actors": "Mark Hamill, Harrison Ford, Carrie Fisher",
    "Plot": "After the Rebels are brutally overpowered by the Empire on the ice planet Hoth, Luke Skywalker begins Jedi training with Yoda, while his friends are pursued across the galaxy by Darth Vader and bounty hunter Boba Fett.",
    "Language": "English",
    "Country": "United States, United Kingdom",
    "Awards": "Won 2 Oscars. 25 wins & 20 nominations total",
    "Poster": "",
    "Ratings": [
            "Source": "Internet Movie Database",
            "Value": "8.7/10"
            "Source": "Rotten Tomatoes",
            "Value": "94%"
            "Source": "Metacritic",
            "Value": "82/100"
    "Metascore": "82",
    "imdbRating": "8.7",
    "imdbVotes": "1,209,128",
    "imdbID": "tt0080684",
    "Type": "movie",
    "DVD": "21 Sep 2004",
    "BoxOffice": "$292,753,960",
    "Production": "N/A",
    "Website": "N/A",
    "Response": "True"

Sample rating:

ratedMovies = [{imdbID: 'tt0080684', userRating: 8}]


Ok if I understand it correctly it goes like this:

let data =;
let newMovieId = data.imdbID;
ratedMovies.forEach((movie) => {
    if(movie.imdbID === newMovieId) {
        data.userRating = movie.userRating;


code above goes inside the axios success callback