ternaries
3항 조건 연산자(Ternaries) ? :
는 React 개발에서 조건에 따라 코드를 나눠 처리해야 할 때 자주 사용됩니다.
function nullish(n) {
return n != null ? n : 0
}
// ————————————————————————————————————————————————————
function nullish(n) {
if (n!= null) {
return n
} else {
return 0
}
}
Last updated
Was this helpful?