उदाहरण
लॉजिकल NOT (!) ऑपरेटर का उपयोग करके स्पेसिफिक वैल्यू को इग्नोर करें।
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);
}
}
प्रोग्राम चलाने के लिए:
node fileName.js
आउटपुट
PS C:\Users\Amit\javascript-code> node demo179.js The country name is=US The country name is=UK