Last active
August 25, 2017 11:50
-
-
Save akameco/fe6189123f067641c5429b299b9e85f2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let name = ‘ゲスト’ | |
try { | |
name = awiat getName() | |
} catch (err) { } | |
console.log(`ようこそ ${name}さん`) | |
// => ようこそ ゲストさん | |
/// ↓ ↓ ↓ | |
const name = await getName().catch(() => ‘ゲスト’) | |
console.log(`ようこそ ${name}さん`) | |
// => ようこそ ゲストさん |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment