- 인터프리터 언어이다.
- Frontend와 Backend를 같이 할 수 있는 언어이다.
- 브라우저에서 동적 요소를 프로그래밍하는 언어이다.
컴파일 언어
- 번역기가 번역을 하듯이 내가 작성한 언어를 컴파일러가 기계어로 변환을 해줌
- 100줄의 코드가 한번에 변환됨
인터프리터 언어 or 스크립트 언어
- 기계가 알아서 코드를 해석해서 결과물까지 도출해 준다
- 한줄을 실행할 때마다 변환됨
Java vs Javascirpt
- java는 객체지향 언어 ( c++)
- javascript는 prototype 언어
- python은 함수형 언어
Javascript 장점
Javascript 사용하는 방법
브라우저 자체 console 창
브라우저 자체 console 창에서 Hello World! 출력
<!-- index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<script>
console.log("hello world!");
</script>
</head>
<body></body>
</html>
<!-- script 부분에 작성 -->
- html 파일에서 javascript 파일 연결해서 작성
<!-- index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<script src="public/js/index.js"></script>
</head>
<body></body>
</html>
// index.js
console.log('Hi')