전고흐 2021. 7. 4. 15:11
728x90

eslint : coding style 정의 가능???

 

scsss 데이터 보관 : #{ }

js 데이터 보관 : ${ }

 

` (백텟)

const s = "Hello";

const w = `hello ${s}`;

const z = 'Hello ' + s;  // 구식표현, 이 표현보다는 위의 백텟을 사용한 표현을 권장한다.

 

const n = Infinity; // infinity는 숫자 데이터

 

null : 값이 null

undefined : 값을 지정하지 않은 상태

 

객체 데이터

const user = {

    name: 'hello',   // property: data 형식

    age: 20

};

cosole.log(user.name);  

console.log(user['age']);  

 

배열 데이터

const fruits = ['apple', 'banana', 'cherry'];

console.log(fruits[1]);

 

함수 선언

functino sayHi() {

    console.log('hello!');

}

 

함수표현식(변수에 함수 할당)

let sayHi = function() {

    console.log('hello!');

}

 

호이스팅: 함수 선언 한 것들을 모두 끌어올려서 최상단에서 선실행

함수표현식을 사용하게 되면 호이스팅 기능이 동작하지 않는다.

호이스팅이 적용되는 경우

sayHi()   // function이 뒤에 선언되어있지만, 에러없이 실행ㅇ

functino sayHi() {

    console.log('hello!');

}

호이스팅이 될 필요가 없는 경우(코드가 긴 경우 구지 위에서 실행 될 필요가 없을 때) 함수 표현식을 사용하는게 좋음

 

javascript 개인적으로 공부(github 참조)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

728x90