동적언어
-
[Javascript] 자바스크립트의 동적 타입 언어Javascript 2022. 12. 31. 11:33
개발 언어는 정적 타입, 동적 타입으로 나뉜다. 정적언어 정적언어는 변수의 'type'을 컴파일 시에 결정하는 것 Java, C, C#, C++ 등의 언어가 이에 속한다. 이들은 변수를 선언할 때 용도에 맞는 타입을 함께 선언해주어야 한다. String job = '학생'; int age = 19; age = '열아홉' // 컴파일에러 이렇게 int로 선언한 age에 String을 넣으면 컴파일시에 에러가 난다. 동적언어 동적언어는 변수의 'type'을 컴파일 할 때가 아닌 실행 시에 결정한다(거의 인터프리터 언어들 이라고 할 수 있다). Javascript, Python, Ruby 등이 있다. let job = '학생'; let age = 17; age = '열일곱'; // 에러 안남 다음과 같이 에러..