programming/javascript

자바스크립트 기초

chanchand 2023. 1. 15. 03:10
반응형

자바스크립트(JavaScript)

프론트엔드에서 사용할 수 있는 유일한 프로그래밍 언어

백엔드에서도 사용할 수 있다.

모든 브라우저에 내장되어 있다.

vanilla JS : 외부 라이브러리나 프레임워크를 쓰지 않는 순수 자바스크립트

three.js : 3D 구현 라이브러리 

ml5.js : 머신러닝 모델 

react native : android, ios app

 

 

브라우저

브라우저는 HTML을 열고, HTML은 CSS와 자바스크립트를 가져온다.

 

- index.html

- script.js

- style.css

<!DOCTYPE html>
<html>
    <head>
        <link rel="stylesheet" href="style.css" />
    </head>
    <body>
        <script src="script.js"></script>
    </body>
</html>

 

 

Variable

기본적으로 const 사용하고, 필요한 경우에 따라 let 사용한다.

const : constant(상수), 값을 업데이트 할 수 없다.

let : 업데이트 가능

var : 과거 방식, 업데이트 가능

 

 

Booleans

true

false

null

undefined

 

 

 

Objects

const player = {
  name : "",
  points:10,
  fat:true,
};

console.log(player.name);
console.log(player['points'];

 

 

const의 수정은 여전히 가능하지 않다.

object의 내부를 변경하는 것은 가능하나, constant 전체를 하나의 값으로 업데이트 하는 것은 불가능하다.

 

player.points=15;
player.lastName="KIM";

 

 

 

 

반응형