<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="icon" href="data:;base64,iVBORw0KGgo=">
<script type="text/javascript">
var a, b, c;
// +, -, *, /, %, ++, --
c = 10 / 0;
console.log(c); // Infinity : 무한대를 나타내는 숫자
if(c === Infinity) {
console.log('0으로 나누었습니다.');
}
a = 2;
b = 10;
c = a ** b; // 거듭 제곱
console.log(c); // 1024
c = 2 ** 3 ** 2; // 2 ** (3 ** 2)과 동일. 우결합성
console.log(c); // 512
// c = -2 ** 2; // 에러. 모호한 표현은 허용하지 않음
// 문자열 결합
a = "seoul";
b = "korea";
c = a + b ;
console.log(c);
a = 10;
b = "5";
c = a + b ; // 숫자 + 문자 => 문자 + 문자 => 문자
console.log(c); // 105
</script>
</head>
<body>
<h3>연산자</h3>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="icon" href="data:;base64,iVBORw0KGgo=">
<script type="text/javascript">
var a, b;
a = '123';
b = 123;
console.log(a == b); // true
console.log(a === b); // false(동치). 두 값을 비교할 때는되도록이면 ===을 사용할 것을 권장
console.log(a != b); // false
console.log(a !== b); // true(동치가 아닐 경우 참)
</script>
</head>
<body>
<h3>연산자 - 비교 연산자</h3>
</body>
</html>