Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit622978b

Browse files
authored
nullish coalescing operator
1 parentad8e0c8 commit622978b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

‎README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,3 +374,19 @@ window.addEventListener('contextmenu', ()=>{
374374
//With defer, browser will run your script when the page finished parsing. (not necessary finishing downloading all image files.
375375
<scriptdefersrc="myscript.js"></script>
376376
```
377+
378+
# nullish coalescing operator
379+
```javascript
380+
381+
// an equality check against nullary values (e.g. null or undefined). Whenever the expression to the left of the ?? operator evaluates to either //undefined or null, the value defined to the right will be returned.
382+
383+
constfoo=undefined??'default string';
384+
console.log(foo);
385+
// expected output: "default string"
386+
387+
388+
constage=0??30;
389+
console.log(age);
390+
// expected output: "0"
391+
```
392+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp