Compare and print the value from array of array using node js

Is there any way to check and compare value of array of array with the name only and print the matched value and unmatched value separately?

arrayToCheck =[
  {
    id: 1,
    name:Java,
    description: language
  },
  {
    id: 2,
    name:JavaScript,
    description: language
  },
  {
    id: 3,
    name:Oops,
    description: Subject
  },
  {
    id: 4,
    name:Java,
    description: Practical
  },
  {
    id: 5,
    name:Oops,
    description: Practical
  },
  {
    id: 6,
    name:React Js,
    description: Practical
  },
]

valueToCheck= JavaScript;

Expected Output:

matchedValue = JavaScript

unMatchedValue = ['Java', 'Oops','React Js']; //filter repeated data

Answer

First- Your array was made incorrectly.

It should have been like this.

var arrayToCheck =[
  {
    id: 1,
    name:"Java",
    description: "language",
  },
  {
    id: 2,
    name:"JavaScript",
    description: "language",
  },
  {
    id: 3,
    name:"Oops",
    description: "Subject",
  },
  {
    id: 4,
    name:"Java",
    description: "Practical",
  },
  {
    id: 5,
    name:"Oops",
    description: "Practical",
  },
  {
    id: 6,
    name:"React Js",
    description: "Practical",
  },
]

You should also have a filter before all your code. Like this-

var filter = {
name: "JavaScript"
};

Now you should have something like this.

var filter = {
name: "JavaScript"
};
var arrayToCheck =[
  {
    id: 1,
    name:"Java",
    description: "language",
  },
  {
    id: 2,
    name:"JavaScript",
    description: "language",
  },
  {
    id: 3,
    name:"Oops",
    description: "Subject",
  },
  {
    id: 4,
    name:"Java",
    description: "Practical",
  },
  {
    id: 5,
    name:"Oops",
    description: "Practical",
  },
  {
    id: 6,
    name:"React Js",
    description: "Practical",
  },
]

Now to use the filter and log it in the console.

var filter = {
name: "JavaScript"
};
var arrayToCheck =[
  {
    id: 1,
    name:"Java",
    description: "language",
  },
  {
    id: 2,
    name:"JavaScript",
    description: "language",
  },
  {
    id: 3,
    name:"Oops",
    description: "Subject",
  },
  {
    id: 4,
    name:"Java",
    description: "Practical",
  },
  {
    id: 5,
    name:"Oops",
    description: "Practical",
  },
  {
    id: 6,
    name:"React Js",
    description: "Practical",
  },
]
arrayToCheck= arrayToCheck.filter(function(item) {
  for (var key in filter) {
    if (item[key] === undefined || item[key] != filter[key])
      return false;
  }
  return true;
});

console.log(arrayToCheck)