Nullish coalescing Operator 空值合并

  • let x = (foo !== null && foo !== undefined)
        ? foo
        : bar();
  • 版本二:
  • let x = foo ?? bar();
posted @ 2020-11-25 14:51  酸suan  阅读(137)  评论(0编辑  收藏  举报