[JS] 데이터 타입 (숫자, 문자열, 불리언)

2021. 7. 15. 20:08
728x90

 

 

01 데이터 타입

  • 타입(data type) 이란 프로그램에서 다룰 수 있는 값의 종류이다.

 

 

 

02 원시타입 (primitive type)

  • 숫자 (number)
  • 문자열 (string)
  • 불리언 (boolean)

 

 

 

 

<!DOCTYPE html>
<html>
<head>
  <meta charset='utf-8'>
  <meta http-equiv='X-UA-Compatible' content='IE=edge'>
  <title>데이터 타입</title>
  <meta name='viewport' content='width=device-width, initial-scale=1'>
  <script>
    /*
      숫자, 문자열, 논리값
    */
   document.write("<h3><숫자></h3>")
   //숫자 출력
  //문자열과는 달리 숫자는 "" 묶지 않는다.
   document.write(30,"<br>");
   document.write(30 + 60,"<br>");
   document.write(30 * 60,"<br><br>");
 
   document.write("<h3><문자열></h3>")
   //문자열
   document.write('Hello<br>');
   document.write("안녕하세요<br><br>");
 
   document.write("<h3><논리값></h3>")
   //논리값 - true, false
   document.write(true,"<br>");
   document.write(false,"<br>");
 
  </script>
</head>
<body>  
</body>
</html>
728x90

'JavaScript > Study' 카테고리의 다른 글

JS 상수 (const)  (0) 2021.07.15
JS 산술 연산자 (+, -, *, /, %)  (0) 2021.07.15
JS 변수 (변수 선언, 변수 초기화, 식별자, var)  (0) 2021.07.15
[JS] 주석 (//, /* */, <!-- -->)  (0) 2021.07.15
[JS] 출력 (document.write)  (0) 2021.07.15

BELATED ARTICLES

more