Topic

Clean Code

A collection of 3 issues

โŒ if-else-return โ†’ ๐ŸŸข if-return-return

์–ด๋Š ์ˆœ๊ฐ„๋ถ€ํ„ฐ ์กฐ๊ฑด๋ฌธ์„ ์“ธ ๋•Œ ์ฃผ์ ˆ(main clause)์— ํ•ด๋‹นํ•˜๋Š” ์ผ€์ด์Šค์ธ์ง€๋ฅผ ๋จผ์ € ์ฒดํฌํ•˜๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ผ async function onSubmitForm () { if (isValidForm) { const formattedForm = formatForm() await submitForm(formatForm()) } else { showErrorMsg() } } ์˜ˆ์™ธ์ ˆ์— ํ•ด๋‹นํ•˜๋Š”์ง€๋ฅผ ย ๋จผ์ € ์ฒดํฌํ•˜๊ธฐ ์‹œ์ž‘ํ–ˆ๋‹ค. async function onSubmitForm () { if (!isValidForm) return showErrorMsg() const formattedForm = formatForm() await submitForm(formatForm()) } ๋ฟ๋งŒ ์•„๋‹ˆ๋ผ if ์™€
5 min read

Subscribe to go-kahlo-lee

Donโ€™t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe