!= বা লজিক্যাল 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