카테고리 없음

삼항연산자(수정하기)

개발하는체대생 2022. 9. 20. 19:18
let class_heart = ""

if (post["heart_by_me"]) {
    class_heart = "fa-heart"
} else {
    class_heart = "fa-heart-o"
}

위의 것과 같은 뜻

let class_heart = post['heart_by_me'] ? "fa-heart": "fa-heart-o"