close
Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update 1-js/02-first-steps/12-nullish-coalescing-operator/article.md
Co-authored-by: Taras <oster.ok@gmail.com>
  • Loading branch information
MykolaSopiha and tarasyyyk authored Nov 15, 2021
commit aa57e17e8dc34daafe82aa3c41e9a8081023f69e
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ alert(user ?? "Анонімний"); // Іван (user визначений)

Ми також можемо використовувати послідовність з `??`, щоб вибрати перше значення зі списку, яке не є `null/undefined`.

Скажімо, у нас є дані користувача в змінних `firstName`,` lastName` або `nickName`. Всі вони можуть бути не визначені, якщо користувач вирішив не вводити значення.
Скажімо, у нас є дані користувача в змінних `firstName`, `lastName` або `nickName`. Всі вони можуть бути не визначені, якщо користувач вирішив не вводити значення.

Ми хотіли б показати ім’я користувача, використовуючи одну з цих змінних, або показати "Анонімний", якщо всі вони не визначені.

Expand Down