홈페이지 입문 1. 자바 스크립트 배워보기. 혼공 자바스크립트 참고.
환경 : 비쥬얼 스튜디오 코드 설치하기.
https://code.visualstudio.com/
Visual Studio Code - Code Editing. Redefined
Visual Studio Code is a code editor redefined and optimized for building and debugging modern web and cloud applications. Visual Studio Code is free and available on your favorite platform - Linux, macOS, and Windows.
code.visualstudio.com
2. 점유율을 비교해보자.
Statcounter Global Stats - Browser, OS, Search Engine including Mobile Usage Share
Tracks the Usage Share of Search Engines, Browsers and Operating Systems including Mobile from over 5 billion monthly page views.
gs.statcounter.com
3. 크롬을 설치하고 개발자 도구에서 colsone.log를 쳐보자.
4. 화면에 alert를 띄워보자.
<!DOCTYPE html>
<html>
<head>
<title>Document</title>
<script>
alert('Hello World')
</script>
</head>
<body>
</body>
</html>
5. 만약 오류가 날 때 인터넷 창에서 확인 하는 법.
콘솔을 열면 어떤 줄이 잘못 되었는지와 오류 내용이 나온다. alert 이라고 해야 하는데 alret이라고 잘못 쳤음.
키워드 : if, else, var, try 이런 것.
파이썬에서도 키워드 혹은 예약어 라고 했는데 자바스크립트는 키워드라고 쓰나보다.
식별자(identifier) : 변수같은거 만들 때 사용하는 단어.
사용규칙 :
특수문자는 쓰면 안된다.( _ , $ 제외)
키워드는 쓰면 안된다.
숫자를 써도 되긴 하는데 맨 앞에 쓰면 안된다.
자바스크립트 관례 :
변수, 함수, 메소드 등이 여러 단어일 때는 카멜 케이스(두번 째부터 대문자 시작)
boolean형을 쓸 때 파이썬은 True와 False, 이렇게 대문자로 해야 했는데 자바 스크립트는 소문자로 해야한다.
true, false.
반대로 쓰고싶으면
!true, !false 이렇게 하면 된다.
and, or 실습해보기.