To ignore a specific value, use the logical Not (!) operator in if condition and fetch watching you want to include.
Example
var customerDetails=[
{
customerName:"John",
customerAge:28,
customerCountryName:"US"
},
{
customerName:"David",
customerAge:25,
customerCountryName:"AUS"
},
{
customerName:"Mike",
customerAge:32,
customerCountryName:"UK"
}
]
for(var i=0;i<customerDetails.length;i++){
if(customerDetails[i].customerCountryName!="AUS"){
console.log("The country name
is="+customerDetails[i].customerCountryName);
}
}To run the above program, you need to use the following command −
node fileName.js.
Here, my file name is demo179.js.
Output
This will produce the following output −
PS C:\Users\Amit\javascript-code> node demo179.js The country name is=US The country name is=UK