JavaScript Data Types
JavaScript variables can hold many data types: numbers, strings, objects and more:
자바스크립트 데이터 타입
자바스크립트 변수는 많은 종류의 데이터 타입을 저장한다. 숫자, 스트링, 객체 그 이상
The Concept of Data Types
In programming, data types is an important concept.
To be able to operate on variables, it is important to know something about the type.
Without data types, a computer cannot safely solve this:
데이터 타입의 개념
프로그래밍에서 데이터 타입은 가장 중요한 개념이다.
변수에 값을 계산하기 위해서 타입에 대한 조금의 내용을 아는 것은 중요하다.
데이터 타입 없이 컴퓨터는 안전하게 계산할수 없다.
Does it make any sense to add "Volvo" to sixteen? Will it produce an error or will it produce a result?
JavaScript will treat the example above as:
16에 "Volvo"를 더하는 것이 말이 되는가?
에러를 만들것인가? 혹은 결과를 만들것인가?
자바스크립트는 위의 내용을 예제와 같이 대응한다.
When adding a number and a string, JavaScript will treat the number as a string.
스트링과 숫자를 더할때, 자바스크립트는 숫자를 스트링처럼 다룬다.
JavaScript evaluates expressions from left to right. Different sequences can produce different results:
자바스크립트는 왼쪽에서부터 오른쪽표현식으로 계산한다.
다른 순서는 다른 결과를 만들 수 있다.
In the first example, JavaScript treats 16 and 4 as numbers, until it reaches "Volvo".
In the second example, since the first operand is a string, all operands are treated as strings.
첫번째 예제에서 자바스크립트는 "Volvo"에 도달할때까지 16과 4를 숫자로서 다뤘고,
두번쨰 예제는 첫번째, 피연산자가 스트링이기 때문에 모든 피연산자는 스트링으로 다뤄진다.
JavaScript Types are Dynamic
JavaScript has dynamic types. This means that the same variable can be used to hold different data types:
자바스크립트타입은 동적이다.
자바스크립트 는 동적 타입을 가지고 있다. 이것은 같은 변수에 다른 타입의 값을 사용할수 있다는 것을 의미한다.
JavaScript Strings
A string (or a text string) is a series of characters like "John Doe".
Strings are written with quotes. You can use single or double quotes:
스트링은 "John Doe"와 같은 문자열의 시리즈이다.
스트링은 쿼터로 쓰여졌고, 너는 싱글이나, 더블쿼터를 사용할 수 있다.
You can use quotes inside a string, as long as they don't match the quotes surrounding the string:
너는 그들의 쿼터가 주변 스트링에 매칭되지 않는한, 쿼터를 스트링 내부에 사용할 수 있다?
JavaScript Numbers
JavaScript has only one type of numbers.
Numbers can be written with, or without decimals:
자바스크립트는 오직 하나의 숫자 타입을 가진다.
숫자는 십진수로 혹은 십진수가 아닌 것으로 작성되어질 수 있다.
JavaScript Booleans
Booleans can only have two values: true or false.
Booleans 는 오직 true 혹은 false 값을 가진다.
Booleans are often used in conditional testing.
You will learn more about conditional testing later in this tutorial.
Booleans 는 조건적인 테스팅에 자주 사용되어진다.
너는 이번 챕터 후에 조건적인 테스팅에 대해 좀더 배울것이다.
JavaScript Arrays
JavaScript arrays are written with square brackets.
Array items are separated by commas.
The following code declares (creates) an array called cars, containing three items (car names):
배열은 [] 로 작성되어진다.
배열 아이템은 콤마에 의해 구분되어진다.
다음의 코드는 car라고 불리우는 배열을 선언한다. 3개의 아이템을 포함하는..
Array indexes are zero-based, which means the first item is [0], second is [1], and so on.
You will learn more about arrays later in this tutorial.
배열 인덱스는 제로부터 시작하고, [0]은 첫번쨰, [1]은 두번째를 의미한다.
너는 이번 챕터 후에 배열에 대해서 좀더 배울 것이다.
JavaScript Objects
JavaScript objects are written with curly braces {}.
Object properties are written as name:value pairs, separated by commas.
객체는 {} 로 작성되어진다.
객체의 속성은 이름: 값 의 쌍으로 작성되어지고, 콤마로 구분된다.
The object (person) in the example above has 4 properties: firstName, lastName, age, and eyeColor.
You will learn more about objects later in this tutorial.
위의 예제에서 사람객체는 4개의 속성을 가진다.
성 이름 나이 눈 색깔
너는 이번챕터 후에 객체에 대해서 좀더 배울것이다.
Null
In JavaScript null is "nothing". It is supposed to be something that doesn't exist.
Unfortunately, in JavaScript, the data type of null is an object.
자바스크립트에서 null은 아무것도 아니다. 이것은 존재하지 않는 어떤것으로 여겨진다.
불운하게도, 자바스크립트에서 널의 데이터 타입은 객체이다.
You can consider it a bug in JavaScript that typeof null is an object. It should be null.
자바스크립트에서 null은 객체다라는 것은 너는 버그라고 생각할수 있다.
이것은 null일것이다.
You can empty an object by setting it to null:
너는 객체에 null을 셋팅함으로서 객체를 비우게 만들수 있다.
You can also empty an object by setting it to undefined:
너는 또한 객체에 undefinded를 설정함으로서 객체를 비우게 만들수 있다.
Difference Between Undefined and Null
undefined and null are equal in value but different in type:
undefined와 null은 값은 같지만, 타입이 다르다.
Primitive Data
A primitive data value is a single simple data value with no additional properties and methods.
The typeof operator can return one of these primitive types:
- string
- number
- boolean
- undefined
기본적인 데이터는 추가적인 속성이나, 메소드가 없는 단순한 데이터다.
typeof 연산자는 아래의 원시 타입중 하나를 반환한다.
Complex Data
The typeof operator can return one of two complex types:
- function
- object
The typeof operator returns "object" for objects, arrays, and null.
The typeof operator does not return "object" for functions.
복잡한 데이터
typeof 연산자는 두가지 복잡한 타입중 하나를 반환할 수 있다.
function 과 object
배열이나, null에는 object 타입을 반환하지만,
function 에는 object를 반환하지 않는다.
'영어공부' 카테고리의 다른 글
Is the single page application the new normal? (0) | 2022.06.04 |
---|---|
Guide to Java Versions and Features (0) | 2022.01.08 |
JavaScript Variables (0) | 2020.02.12 |
JavaScript Comments (0) | 2020.02.12 |
JavaScript Syntax (0) | 2020.01.23 |
JavaScript Data Types
JavaScript variables can hold many data types: numbers, strings, objects and more:
자바스크립트 데이터 타입
자바스크립트 변수는 많은 종류의 데이터 타입을 저장한다. 숫자, 스트링, 객체 그 이상
The Concept of Data Types
In programming, data types is an important concept.
To be able to operate on variables, it is important to know something about the type.
Without data types, a computer cannot safely solve this:
데이터 타입의 개념
프로그래밍에서 데이터 타입은 가장 중요한 개념이다.
변수에 값을 계산하기 위해서 타입에 대한 조금의 내용을 아는 것은 중요하다.
데이터 타입 없이 컴퓨터는 안전하게 계산할수 없다.
Does it make any sense to add "Volvo" to sixteen? Will it produce an error or will it produce a result?
JavaScript will treat the example above as:
16에 "Volvo"를 더하는 것이 말이 되는가?
에러를 만들것인가? 혹은 결과를 만들것인가?
자바스크립트는 위의 내용을 예제와 같이 대응한다.
When adding a number and a string, JavaScript will treat the number as a string.
스트링과 숫자를 더할때, 자바스크립트는 숫자를 스트링처럼 다룬다.
JavaScript evaluates expressions from left to right. Different sequences can produce different results:
자바스크립트는 왼쪽에서부터 오른쪽표현식으로 계산한다.
다른 순서는 다른 결과를 만들 수 있다.
In the first example, JavaScript treats 16 and 4 as numbers, until it reaches "Volvo".
In the second example, since the first operand is a string, all operands are treated as strings.
첫번째 예제에서 자바스크립트는 "Volvo"에 도달할때까지 16과 4를 숫자로서 다뤘고,
두번쨰 예제는 첫번째, 피연산자가 스트링이기 때문에 모든 피연산자는 스트링으로 다뤄진다.
JavaScript Types are Dynamic
JavaScript has dynamic types. This means that the same variable can be used to hold different data types:
자바스크립트타입은 동적이다.
자바스크립트 는 동적 타입을 가지고 있다. 이것은 같은 변수에 다른 타입의 값을 사용할수 있다는 것을 의미한다.
JavaScript Strings
A string (or a text string) is a series of characters like "John Doe".
Strings are written with quotes. You can use single or double quotes:
스트링은 "John Doe"와 같은 문자열의 시리즈이다.
스트링은 쿼터로 쓰여졌고, 너는 싱글이나, 더블쿼터를 사용할 수 있다.
You can use quotes inside a string, as long as they don't match the quotes surrounding the string:
너는 그들의 쿼터가 주변 스트링에 매칭되지 않는한, 쿼터를 스트링 내부에 사용할 수 있다?
JavaScript Numbers
JavaScript has only one type of numbers.
Numbers can be written with, or without decimals:
자바스크립트는 오직 하나의 숫자 타입을 가진다.
숫자는 십진수로 혹은 십진수가 아닌 것으로 작성되어질 수 있다.
JavaScript Booleans
Booleans can only have two values: true or false.
Booleans 는 오직 true 혹은 false 값을 가진다.
Booleans are often used in conditional testing.
You will learn more about conditional testing later in this tutorial.
Booleans 는 조건적인 테스팅에 자주 사용되어진다.
너는 이번 챕터 후에 조건적인 테스팅에 대해 좀더 배울것이다.
JavaScript Arrays
JavaScript arrays are written with square brackets.
Array items are separated by commas.
The following code declares (creates) an array called cars, containing three items (car names):
배열은 [] 로 작성되어진다.
배열 아이템은 콤마에 의해 구분되어진다.
다음의 코드는 car라고 불리우는 배열을 선언한다. 3개의 아이템을 포함하는..
Array indexes are zero-based, which means the first item is [0], second is [1], and so on.
You will learn more about arrays later in this tutorial.
배열 인덱스는 제로부터 시작하고, [0]은 첫번쨰, [1]은 두번째를 의미한다.
너는 이번 챕터 후에 배열에 대해서 좀더 배울 것이다.
JavaScript Objects
JavaScript objects are written with curly braces {}.
Object properties are written as name:value pairs, separated by commas.
객체는 {} 로 작성되어진다.
객체의 속성은 이름: 값 의 쌍으로 작성되어지고, 콤마로 구분된다.
The object (person) in the example above has 4 properties: firstName, lastName, age, and eyeColor.
You will learn more about objects later in this tutorial.
위의 예제에서 사람객체는 4개의 속성을 가진다.
성 이름 나이 눈 색깔
너는 이번챕터 후에 객체에 대해서 좀더 배울것이다.
Null
In JavaScript null is "nothing". It is supposed to be something that doesn't exist.
Unfortunately, in JavaScript, the data type of null is an object.
자바스크립트에서 null은 아무것도 아니다. 이것은 존재하지 않는 어떤것으로 여겨진다.
불운하게도, 자바스크립트에서 널의 데이터 타입은 객체이다.
You can consider it a bug in JavaScript that typeof null is an object. It should be null.
자바스크립트에서 null은 객체다라는 것은 너는 버그라고 생각할수 있다.
이것은 null일것이다.
You can empty an object by setting it to null:
너는 객체에 null을 셋팅함으로서 객체를 비우게 만들수 있다.
You can also empty an object by setting it to undefined:
너는 또한 객체에 undefinded를 설정함으로서 객체를 비우게 만들수 있다.
Difference Between Undefined and Null
undefined and null are equal in value but different in type:
undefined와 null은 값은 같지만, 타입이 다르다.
Primitive Data
A primitive data value is a single simple data value with no additional properties and methods.
The typeof operator can return one of these primitive types:
- string
- number
- boolean
- undefined
기본적인 데이터는 추가적인 속성이나, 메소드가 없는 단순한 데이터다.
typeof 연산자는 아래의 원시 타입중 하나를 반환한다.
Complex Data
The typeof operator can return one of two complex types:
- function
- object
The typeof operator returns "object" for objects, arrays, and null.
The typeof operator does not return "object" for functions.
복잡한 데이터
typeof 연산자는 두가지 복잡한 타입중 하나를 반환할 수 있다.
function 과 object
배열이나, null에는 object 타입을 반환하지만,
function 에는 object를 반환하지 않는다.
'영어공부' 카테고리의 다른 글
Is the single page application the new normal? (0) | 2022.06.04 |
---|---|
Guide to Java Versions and Features (0) | 2022.01.08 |
JavaScript Variables (0) | 2020.02.12 |
JavaScript Comments (0) | 2020.02.12 |
JavaScript Syntax (0) | 2020.01.23 |