조건식 ? 조건식이 true일 때 반환할 값 : 조건식이 false일 때 반환할 값
val result = score >= 80? 'Pass : 'Fail';
typeof 연산자
- 피연산자의 데이터 타입을 문자열로 반환
typeof '' // string
typeof 1 // number
typeof NaN // number
typeof true // boolean
typeof undefined // undefined
typeof Symbol() // symbol
typeof null // object
typeof [] // object
typeof {} // object
typeof new Date // object
우선순위 | 연산자 |
---|---|
1 | () |
2 | new(매개변수존재),[].(프로퍼티접근), ()(함수호출), ?. |
3 | new(매개변수미존재) |
4 | x++, x-- |
5 | !x, +x, -x, ++x, --x, typeof, delte |
6 | ** |
7 | *,/, % |
8 | +, - |
9 | <, <=,>,>=,in,instanceof |
10 | ==, !=, ===,!== |
11 | ?? |
12 | && |
13 | || |
14 | ?...:... |
15 | 할당연산자 |
16 | , |