3항 연산자

jw·2022년 3월 4일
0

learn-all-with-javascript

목록 보기
19/33
post-thumbnail

3항 연산자는 if문을 단축 형태로 사용할 수 있다.

기본

 const l = 'javascript'
 if(l=='javascript'){
 	console.log('재밌당')
   }
 else{
 	console.log('재미없당')
 }

3항 연산자

l === 'javascript' ? console.log('재밌당') : console.log('재미없다')
profile
다시태어나고싶어요

0개의 댓글