https://www.w3schools.com/js/js_operators.asp
JavaScript Operators
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.
www.w3schools.com
1.산술 연산자
2.할당 연산자
3.비교 연산자
4.문자열 연산자
5.논리 연산자
6.비트 연산자
7.삼항 연산자
8.연산자 유형
Operator | Description |
+ | 덧셈 |
- | 빼기 |
* | 곱셈 |
** | 지수화(ES2016) |
/ | 나누기 |
% | 계수(나누기 나머지) |
++ | 증가 |
-- | 감소 |
Operator | Example | Same As |
= | x = y | x = y |
+= | x += y | x = x + y |
-= | x -= y | x = x - y |
*= | x *= y | x = x * y |
/= | x /= y | x = x / y |
%= | x %= y | x = x % y |
**= | x **= y | x = x ** y |
Operator | Description |
== | 동일 |
=== | 동등한 가치와 동등한 유형 |
!= | 같지 않다 |
!== | 값이 같지 않거나 같지 않은 유형 |
> | ~보다 큰 |
< | 미만 |
>= | 보다 크거나 같음 |
<= | 이하 |
? | 삼항 연산자 |
[예제]
let text1 = "A";
let text2 = "B";
let result = text1 < text2;
문자열은 알파벳순으로 비교됩니다.
[예제]
let text1 = "20";
let text2 = "5";
let result = text1 < text2;
[예제]
let text1 = "John";
let text2 = "Doe";
let text3 = text1 + " " + text2;
[예제]
let text1 = "What a very ";
text1 += "nice day";
[결과]
What a very nice day
[예제]
let x = 5 + 5;
let y = "5" + 5;
let z = "Hello" + 5;
[결과]
10
55
Hello5
숫자와 문자열을 더하면 결과는 문자열이 됩니다!
Operator | Description |
&& | logical and |
|| | logical or |
! | logical not |
Operator | Description | Example | Same as | Result | Decimal |
& | AND | 5 & 1 | 0101 & 0001 | 0001 | 1 |
| | OR | 5 | 1 | 0101 | 0001 | 0101 | 5 |
~ | NOT | ~ 5 | ~0101 | 1010 | 10 |
^ | XOR | 5 ^ 1 | 0101 ^ 0001 | 0100 | 4 |
<< | left shift | 5 << 1 | 0101 << 1 | 1010 | 10 |
>> | right shift | 5 >> 1 | 0101 >> 1 | 0010 | 2 |
>>> | unsigned right shift | 5 >>> 1 | 0101 >>> 1 | 0010 | 2 |
Operator | Description |
typeof | 변수의 유형을 반환합니다. |
instanceof | 객체가 객체 유형의 인스턴스인 경우 true를 반환합니다. |
[뷰어]Autodesk의 DWG, DXF 파일 뷰어(무료 설치) (0) | 2023.08.23 |
---|---|
[JavaScript]Output_자바스크립트 출력방법의 종류와 예 (0) | 2023.08.05 |
[PHP]Operators_PHP연산자의 종류와 설명 (0) | 2023.08.03 |
[Javascript]볼륨조절 슬라이드바 만들기_input range (0) | 2023.08.02 |
[JavaScript] input의 입력값(value) 받기 6가지 방법 (0) | 2023.08.01 |
댓글 영역