javascript
-
자바스크립트 특징Javascript 2023. 4. 27. 12:54
다른 부분을 신경쓰고 있던 나는 자바스크립트를 기억에서 삭제했다. 그래서 다시한다. 자바스크립트 자바스크립트란? 자바스크립트는 객체 기반의 스크립트 언어로, 웹의 동적 구현을 위해 사용되는 프로그래밍 언어이다. 👉 웹 개발, 서버 개발 등 다양하게 활용 가능하다. 특징 1. 자바스크립트는 객체 기반의 스크립트 언어다. 객체 : property(속성 - 이름, 값으로 구성)와 method(메소드-객체에 저장된 값이 함수일 때 메소드라 부른다)로 구성된 데이터 집합 2. 자바스크립트는 동적이며, 타입을 명시할 필요가 없는 인터프리터 언어다. 인터프리터 언어: 소스 코드를 별도의 컴파일 과정 없이, 실행 중 소스를 해석해 실행하는 언어 - 장점: 코드를 즉시 실행하고 수정할 때도 즉시 반영 가능해 개발 속도가..
-
스코프(scope)와 호이스팅(hoisting)Javascript 2023. 4. 10. 23:06
스코프(Scope) 변수의 유효범위. 선언한 변수가 영향을 미치는 범위를 의미함. 호이스팅(Hoisting) 인터프리터가 변수와 함수의 메모리 공간을 선언 전에 미리 할당하는 것 변수의 선언과 초기화를 분리 후, 선언만 코드의 최상단으로 옮기는 것 (자바스크립트는 초기화를 제외한 선언만 호이스팅한다.) → 함수나 변수 선언하기 전에 호출해도 에러가 발생하지 않음 *인터프리터 : 프로그래밍 언어의 소스 코드를 바로 실행하는 프로그램 var 재선언 O, 재할당(타입 변경도 가능) O / 함수 스코프 (또는 전역 스코프) 더보기 블록 기준으로 스코프가 생기지 않아, 코드블록 내에 변수를 선언했어도 해당 변수는 전역변수가 된다.var로 선언한 변수는 어디서든 참조할 수 있으나, 변수에 할당하기 전에는 값은 un..