xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

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

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing_operator

ES 2020

nullish coalescing operator (??)

空值合并操作符

refs



©xgqfrms 2012-2020

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @   xgqfrms  阅读(168)  评论(4编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2019-08-20 Android Deep Link & iOS Universal Link & URL Scheme All In One
2019-08-20 Electron 桌面应用的开发
2019-08-20 2019 谷歌开发者大会!
2019-08-20 BFF & SFF
2019-08-20 js & strict mode & setter & getter
2016-08-20 如何解决 Angularjs 加载时 {{ text}} 的刷新闪烁 && 如何解决 Angular 初始化闪烁
2016-08-20 AngularJS 常见错误 && 解决方案
点击右上角即可分享
微信分享提示