js logical operation All In One
js logical operation All In One
js 逻辑运算
Logical AND (&&)
Logical AND assignment (&&=)
Logical OR (||)
Logical OR assignment (||=)
Logical NOT (!)
Logical nullish assignment (??=)
Logical AND (&&
)
逻辑
与
Logical OR (||
)
逻辑
或
const a = 3;
const b = -2;
console.log(a > 0 || b > 0);
// expected output: true
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_OR
Logical NOT (!
)
逻辑非
Logical nullish assignment (??=
)
逻辑空值合并
const foo = null ?? 'default string';
console.log(foo);
// "default string"
const baz = 0 ?? 42;
console.log(baz);
// 0
ES 2020
nullish coalescing operator (??)
空值合并
操作符
refs
©xgqfrms 2012-2020
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/13533341.html
未经授权禁止转载,违者必究!