특정 값을 무시하려면 if 조건에서 논리적 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.
여기에서 내 파일 이름은 demo179.js입니다.
출력
이것은 다음과 같은 출력을 생성합니다 -
PS C:\Users\Amit\javascript-code> node demo179.js The country name is=US The country name is=UK