JavaScript 02 연산자 종류 (Operators)

김민호·2021년 7월 27일
0

JavaScript

목록 보기
2/21
post-thumbnail

비교연산자(Comparison operators)

  • score가 90보다 크거나 같고 100보다 작거나 같다를 표현하려면
    90 <= score && score <= 100
  • 엄격일치연산자 === : value 뿐만 아니라 type도 같아야 true 뜸

논리연산자(Logical operators)

  • && (and 연산자) : 좌항과 우항이 모두 참일 경우에만 참
    t && t -> t
    t && f -> f
    f && t -> f
    f && f -> f

  • || (or 연산자) : 좌항과 우항중에 하나만 참이어도 참
    t || t -> t
    t || f -> t
    f || t -> t
    f || f -> f

  • ! (not연산자) : Boolean값 역전
    !t && !t -> f
    !t && !f -> f
    !f && !t -> f
    !f && !f -> t

숫자연산자(Arithmetic operators)

대입연산자=할당연산자(Assignment operators)

증감연산자(increment and decrement operators)

let x = 10, y = 10;
console.log(++x - 3);	// x의 값을 우선 1 증가시킨 후에 3을 뺌. 8
console.log(y++ - 3);	// 먼저 y에서 3을 뺀 후에 y의 값을 1 증가시킴. 7

출처
https://programmer-seva.tistory.com/8
https://m.blog.daum.net/hsjeong106/55
https://www.slideshare.net/circulus_official/2startup-javascript
https://m.blog.naver.com/PostView.naver?isHttpsRedirect=true&blogId=asd7979&logNo=30111806961
http://tcpschool.com/javascript/js_operator_incAndDec

profile
개발자로서의 삶은 https://velog.io/@maxminos 에서 기록하고 있습니다 😀

0개의 댓글