JavaScript-däki Görnüş we Mana Boyunça Deň Däldiginiň Barlag Operatory
!= operatorundan başga-da,
!== görnüşi hem göz öňünde tutup deňligi barlaýan operator bar.
Geliň olaryň arasyndaky tapawutlary mysallar bilen göreliň.
!= operatory bilen iki sany
3 san deň däl diýip barlansyn.
Bu operator manalaryň deň däldigini barlaýar.
Bizim manalarymyz hakykatdanam deň bolany üçin,
şert ýalňyş bolar:
if (3 != 3) {
console.log('+++');
} else {
console.log('---'); // bu ýerine ýetiriler
}
Indi bolsa, manalarymyzdan biriniň daşynda dyrnak goýup göräýň.
Bu ýagdaýda != operatory ýene-de olary deň hasaplar (sebäbi manalar gabat gelýär,
görnüş bolsa bu operator üçin möhüm däl)
we şert ýene ýalňyş bolar:
if ('3' != 3) {
console.log('+++');
} else {
console.log('---'); // bu ýerine ýetiriler
}
Indi bolsa, iki sany 3 sanyny
!== operatory bilen deňişdireliň.
Bu operator hem olary deň hasaplar:
if (3 !== 3) {
console.log('+++');
} else {
console.log('---'); // bu ýerine ýetiriler
}
Emma indi üçlerden birini dyrnagyn içine alsak,
!== operatory üçlerimizi deň däl hasaplar,
sebäbi olaryň manalary gabat gelýän bolsa-da,
görnüşleri dürlü:
if ('3' !== 3) {
console.log('+++'); // bu ýerine ýetiriler
} else {
console.log('---');
}
Kody işletmezden öň, konsolyň näme çap edjekdigini kesgitläň:
let test1 = '3';
let test2 = '3';
if (test1 != test2) {
console.log('+++');
} else {
console.log('---');
}
Kody işletmezden öň, konsolyň näme çap edjekdigini kesgitläň:
let test1 = '3';
let test2 = '3';
if (test1 !== test2) {
console.log('+++');
} else {
console.log('---');
}
Kody işletmezden öň, konsolyň näme çap edjekdigini kesgitläň:
let test1 = 3;
let test2 = '3';
if (test1 != test2) {
console.log('+++');
} else {
console.log('---');
}
Kody işletmezden öň, konsolyň näme çap edjekdigini kesgitläň:
let test1 = 3;
let test2 = '3';
if (test1 !== test2) {
console.log('+++');
} else {
console.log('---');
}
Kody işletmezden öň, konsolyň näme çap edjekdigini kesgitläň:
let test1 = 3;
let test2 = 2;
if (test1 !== test2) {
console.log('+++');
} else {
console.log('---');
}