쪽으로 평가한 후, 피연산자 중 하나라도 문자열이면 문자열 병합을 수행합니다. 두 값이 모두
숫자형이면 덧셈을 합니다. 다음 두 행을 보십시오.
3
+
5
+ "
8
" // 문자열 "
88
"이 됩니다.
"
3
" +
5
+
8
// 문자열 "
358
"이 됩니다.
첫 행에서 자바스크립트는 먼저
3
+
5
가 덧셈이라고 판단합니다. 그다음에는
8
+ "
8
"
을 문자
열 병합이라고 판단합니다. 두 번째 행에서는 먼저
"
3
" +
5
를 병합이라고 판단하고,
"
35
" +
8
역시 병합이라고 판단합니다.
5.7
논리 연산자
우리가 익숙한 산술 연산자는 무한히 많은(컴퓨터의 메모리는 유한하므로 정확히 말한다면 아
주 많은) 숫자를 다룰 수 있지만, 논리 연산자는 불리언 값만 다룰 수 있으며 불리언에는
false
와
true
두 가지 값밖에 없습니다.
수학에서, 그리고 대부분의 프로그래밍 언어에서 논리 연산자는 불리언 값에서만 동작하며 불리
언 값만 반환합니다. 반면 자바스크립트의 논리 연산자는 불리언이 아닌 값도 다룰 수 있고, 놀
랍게도 불리언이 아닌 값을 반환하기도 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.
O’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
I wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
I’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
I'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.