I have checked some links to compare two array but
I want to compare and check if the value which are present in database are similar to value which are present in fileName
Problem is fileName is not and Array and I am passing Value to it via For Each from another function so it can be any value
fileName= JavaScript
fileName= Java
fileName= NodeJs
fileName= ReactJs
fileName= Oops
but singleProduct is array that's why I used for loop to extract name from it.
code:
function checkDoc(data, childProduct, fileName, pathName, req, res) {
  return new Promise((resolve, reject) => {
    Document.findAll({
      raw: true,
      where: {
        product_id: childProduct.id,
      },
    })
      .then((productDoc) => {
  
        productDoc.forEach((singleProduct) => {
          if (singleProduct.name === fileName) {
            //print matched value
          } else {
            //print unmatched value
          }
        });
      })
      .catch(function (err) {
        return reject(
          getFailureResponseJson("Can't be added please try again :) " + err)
        );
      });
  });
}
value present inside singleProduct.name
Oops
Java
JavaScript
value present inside fileName
Oops
Java
JavaScript
NodeJs
ReactJs
Need Output like this
Matched Value:
Oops
Java
JavaScript
Unmatched Value:
NodeJs
ReactJs
 
    