<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script>
/*
<자료형>
- 자료 : 프로그래밍에서 프로그램이 처리할 수 있는 모든 것
- 자료형(type) : 자료 형태에 따라 나눠 놓은 것 (숫자, 문자, 불린형(boolean, 불형), ...)
- 기본자료형
숫자 - number, 문자 - string, boolean불형 - true, false
1. 문자형
글자 하나 또는 한 자 이상
반드시 "", ''로 묶어서 표현
3+7 => 숫자, 10
'3+7' => 문자형, 3+7
5 => 숫자, 5
3.5 => 숫자, 3.5
"5" => 문자형
'5' => 문자형
"3.5" => 문자형
2. 숫자 자료형
- 실수와 정수를 모두 같은 자료형으로 인식
3. boolean 형
- 참(true)과 거짓(flase)을 표현할 때 사용
4. 문자열 연결 연산자
+
문자 + 문자
문자 + 숫자
숫자 + 문자
*/
let num1 = 7;
let num2 = 6;
let booleanValue = false;
document.write(num1+num2); //13
document.write("<br>")
document.write(7+6); //13
document.write("<br>")
booleanValue=num1>num2;
document.write(booleanValue);//true
document.write("<br>")
document.write("3"+"5"); //문자열 35
document.write("num1+num2"); //문자열 num1+num2
document.write("<br>")
document.write("<hr>")
document.write("3"+"+"+"5"+"="+(3+5));
// '3'+'5'+5 = >355
// '3'+'5'+2+4 =>3524
// '3'+'5'+(2+4) =>356
/*
null 과 undefined
*/
let s; //undefined
alert(s);
// let test = hello; //에러, hello는 문자열
let test = "hello"; //'hello';
alert(test); //document.write(test); document.write("<br>")
test=null;
alert(test); //document.write(test); document.write("<br>")
</script>
</head>
<body>
</body>
</html>