JavaScript variables are containers for storing data values.
In this example, x, y, and z, are variables:
자바스크립트 변수는 값을 저장하는 위한 컨테이너이다.
예를들면 x,y,z는 변수이다.
From the example above, you can expect:
- x stores the value 5
- y stores the value 6
- z stores the value 11
위의 예제로 부터 아래의 내용을 예상할수 있다.
x는 5를 저장하고, y는 6을 저장하고, z는 11을 저장한다.
Much Like Algebra
In this example, price1, price2, and total, are variables:
In programming, just like in algebra, we use variables (like price1) to hold values.
In programming, just like in algebra, we use variables in expressions (total = price1 + price2).
From the example above, you can calculate the total to be 11.
프로그래밍에서 값을 묶어 놓기 위해 변수를 사용한다.
프로그래밍에서, 우리는 변수를 사용한다.
위의 예제로부터 너는 total은 11이 됨을 계산할 수 있다.
JavaScript Identifiers
All JavaScript variables must be identified with unique names.
These unique names are called identifiers.
Identifiers can be short names (like x and y) or more descriptive names (age, sum, totalVolume).
The general rules for constructing names for variables (unique identifiers) are:
- Names can contain letters, digits, underscores, and dollar signs.
- Names must begin with a letter
- Names can also begin with $ and _ (but we will not use it in this tutorial)
- Names are case sensitive (y and Y are different variables)
- Reserved words (like JavaScript keywords) cannot be used as names
자바스크립트 식별자
모든 자바스크립트 변수는 특별한 이름으로 식별자가 되어있다.
이 유니크한 이름을 식별자라고 불리운다.
식별자는 x 혹은 y 와 같은 짧은 이름일수 있따. 혹은 age,sum 과 같이 좀더 설명적인 이름일수 있다.
변수를 만드는 일정적은 룰은 다음과 같다.
이름은 문자 숫자 언더스코어 그리고 $를 포함한다.
이름은 문자로 시작되어야한다.
이름은 또한 $ _ 로 시작할수 있다. (그러나, 우리는 이번 튜토리얼에선 사용하지 않을 것이다.)
이름은 대소문자를 구분한다.
예약된 단어는 변수로서 사용되어질 수 없다.
The Assignment Operator
In JavaScript, the equal sign (=) is an "assignment" operator, not an "equal to" operator.
This is different from algebra. The following does not make sense in algebra:
할당 오퍼레이터
자바스크립트에서 = 은 할당 을 의미하고 같은것이 아닌다.
이것은 알제브라와는 다르다.
In JavaScript, however, it makes perfect sense: it assigns the value of x + 5 to x.
(It calculates the value of x + 5 and puts the result into x. The value of x is incremented by 5.)
그러나, 자바스크립트에서 이것은 완벽한 문장이다. 이것은 x에 x+5를 할당한다.
x+5의 값을 계산하고, x에 결과를 넣는다. x의 값은 5가 증가된 값이다.
JavaScript Data Types
JavaScript variables can hold numbers like 100 and text values like "John Doe".
In programming, text values are called text strings.
JavaScript can handle many types of data, but for now, just think of numbers and strings.
Strings are written inside double or single quotes. Numbers are written without quotes.
If you put a number in quotes, it will be treated as a text string.
자바스크립트 데이터 타입
자바스크립트 변수는 100과 같은 숫자를 넣을수 있고, "John Doe" 와 같은 텍스트 값을 넣을수 있다.
프로그래밍에서 텍스트 값은 스트링으로 불리운다.
자바스크립트는 많은 종류의 data 타입을 핸들링 할수 있지만, 지금은 단순하게 숫자와 스트링만 생각하라.
스트링은 더블쿼트와 싱글쿼드 안에서 작성되어진다.
숫자는 쿼트 업이 작성되어진다.
만일 너가 쿼트안에 숫자를 쓴다면, 이것은 스트링으로서 다뤄질 것이다.
Declaring (Creating) JavaScript Variables
Creating a variable in JavaScript is called "declaring" a variable.
You declare a JavaScript variable with the var keyword:
자바스크립트 변수 선언
자바스크립트에서 변수를 생성하는 것은 변수를 선언하는 것으로 불리어진다.
너는 var 키워드로 자바스크립트 변수를 선언한다.
After the declaration, the variable has no value (technically it has the value of undefined).
To assign a value to the variable, use the equal sign:
선언후에, 변수는 값을 가지고 있지 않다. (기술적으로 이건은 undefinded 값을 가지고 있다.)
변수에 값을 할당하기 위해선 = 를 사용한다.
In the example below, we create a variable called carName and assign the value "Volvo" to it.
Then we "output" the value inside an HTML paragraph with id="demo":
위의 예제에서 우리는 carName이라 불리우는 변수를 만들었고, Volvo 값을 할당했다.
그런다음 우리는 demo의 id를 가지고 있는 변수에 output 했다?(넣었다는건가?)
One Statement, Many Variables
You can declare many variables in one statement.
Start the statement with var and separate the variables by comma:
하나의 문장 많은 변수
하나의 문장에 많은 변수를 선언할수 있고,
var 키워드로 문장을 시작하고, 콤마에 의해 각 변수를 구분한다.
Value = undefined
In computer programs, variables are often declared without a value. The value can be something that has to be calculated, or something that will be provided later, like user input.
A variable declared without a value will have the value undefined.
The variable carName will have the value undefined after the execution of this statement:
컴퓨터 프로그램에서 볌수는 자주 값이 없이 선언된다.
변수는 계산되어진 어떤것일수 있고, 또는 후에 유저가 집어넣은것처럼 후에 제공되어질 수 있다.
변수는 값 없이 선언되어진 변수는 undefinded 값을 가질것이다.
carName변수는 이 문장의 끝난 후에 undefined 값을 가질것이다.
Re-Declaring JavaScript Variables
If you re-declare a JavaScript variable, it will not lose its value.
The variable carName will still have the value "Volvo" after the execution of these statements:
자바스크립트 변수 재선언
만일 너가 자바스크립트 변수를 재 선언 한다면, 이것은 값을 잃어버리지 않을 것이다.
carName변수는 아래의 문장이 끝난후에도 여전히 "Volvo" 값을 가질 것이다.
If you put a number in quotes, the rest of the numbers will be treated as strings, and concatenated.
만일 너가 쿼터 안에 숫자를 넣는다면, 숫자의 나머지 부분은 스트링을 다뤄질것이고, 문자열은 합쳐질것이다.
'영어공부' 카테고리의 다른 글
Guide to Java Versions and Features (0) | 2022.01.08 |
---|---|
JavaScript Data Types (0) | 2020.02.12 |
JavaScript Comments (0) | 2020.02.12 |
JavaScript Syntax (0) | 2020.01.23 |
JavaScript Statements (0) | 2020.01.23 |
JavaScript variables are containers for storing data values.
In this example, x, y, and z, are variables:
자바스크립트 변수는 값을 저장하는 위한 컨테이너이다.
예를들면 x,y,z는 변수이다.
From the example above, you can expect:
- x stores the value 5
- y stores the value 6
- z stores the value 11
위의 예제로 부터 아래의 내용을 예상할수 있다.
x는 5를 저장하고, y는 6을 저장하고, z는 11을 저장한다.
Much Like Algebra
In this example, price1, price2, and total, are variables:
In programming, just like in algebra, we use variables (like price1) to hold values.
In programming, just like in algebra, we use variables in expressions (total = price1 + price2).
From the example above, you can calculate the total to be 11.
프로그래밍에서 값을 묶어 놓기 위해 변수를 사용한다.
프로그래밍에서, 우리는 변수를 사용한다.
위의 예제로부터 너는 total은 11이 됨을 계산할 수 있다.
JavaScript Identifiers
All JavaScript variables must be identified with unique names.
These unique names are called identifiers.
Identifiers can be short names (like x and y) or more descriptive names (age, sum, totalVolume).
The general rules for constructing names for variables (unique identifiers) are:
- Names can contain letters, digits, underscores, and dollar signs.
- Names must begin with a letter
- Names can also begin with $ and _ (but we will not use it in this tutorial)
- Names are case sensitive (y and Y are different variables)
- Reserved words (like JavaScript keywords) cannot be used as names
자바스크립트 식별자
모든 자바스크립트 변수는 특별한 이름으로 식별자가 되어있다.
이 유니크한 이름을 식별자라고 불리운다.
식별자는 x 혹은 y 와 같은 짧은 이름일수 있따. 혹은 age,sum 과 같이 좀더 설명적인 이름일수 있다.
변수를 만드는 일정적은 룰은 다음과 같다.
이름은 문자 숫자 언더스코어 그리고 $를 포함한다.
이름은 문자로 시작되어야한다.
이름은 또한 $ _ 로 시작할수 있다. (그러나, 우리는 이번 튜토리얼에선 사용하지 않을 것이다.)
이름은 대소문자를 구분한다.
예약된 단어는 변수로서 사용되어질 수 없다.
The Assignment Operator
In JavaScript, the equal sign (=) is an "assignment" operator, not an "equal to" operator.
This is different from algebra. The following does not make sense in algebra:
할당 오퍼레이터
자바스크립트에서 = 은 할당 을 의미하고 같은것이 아닌다.
이것은 알제브라와는 다르다.
In JavaScript, however, it makes perfect sense: it assigns the value of x + 5 to x.
(It calculates the value of x + 5 and puts the result into x. The value of x is incremented by 5.)
그러나, 자바스크립트에서 이것은 완벽한 문장이다. 이것은 x에 x+5를 할당한다.
x+5의 값을 계산하고, x에 결과를 넣는다. x의 값은 5가 증가된 값이다.
JavaScript Data Types
JavaScript variables can hold numbers like 100 and text values like "John Doe".
In programming, text values are called text strings.
JavaScript can handle many types of data, but for now, just think of numbers and strings.
Strings are written inside double or single quotes. Numbers are written without quotes.
If you put a number in quotes, it will be treated as a text string.
자바스크립트 데이터 타입
자바스크립트 변수는 100과 같은 숫자를 넣을수 있고, "John Doe" 와 같은 텍스트 값을 넣을수 있다.
프로그래밍에서 텍스트 값은 스트링으로 불리운다.
자바스크립트는 많은 종류의 data 타입을 핸들링 할수 있지만, 지금은 단순하게 숫자와 스트링만 생각하라.
스트링은 더블쿼트와 싱글쿼드 안에서 작성되어진다.
숫자는 쿼트 업이 작성되어진다.
만일 너가 쿼트안에 숫자를 쓴다면, 이것은 스트링으로서 다뤄질 것이다.
Declaring (Creating) JavaScript Variables
Creating a variable in JavaScript is called "declaring" a variable.
You declare a JavaScript variable with the var keyword:
자바스크립트 변수 선언
자바스크립트에서 변수를 생성하는 것은 변수를 선언하는 것으로 불리어진다.
너는 var 키워드로 자바스크립트 변수를 선언한다.
After the declaration, the variable has no value (technically it has the value of undefined).
To assign a value to the variable, use the equal sign:
선언후에, 변수는 값을 가지고 있지 않다. (기술적으로 이건은 undefinded 값을 가지고 있다.)
변수에 값을 할당하기 위해선 = 를 사용한다.
In the example below, we create a variable called carName and assign the value "Volvo" to it.
Then we "output" the value inside an HTML paragraph with id="demo":
위의 예제에서 우리는 carName이라 불리우는 변수를 만들었고, Volvo 값을 할당했다.
그런다음 우리는 demo의 id를 가지고 있는 변수에 output 했다?(넣었다는건가?)
One Statement, Many Variables
You can declare many variables in one statement.
Start the statement with var and separate the variables by comma:
하나의 문장 많은 변수
하나의 문장에 많은 변수를 선언할수 있고,
var 키워드로 문장을 시작하고, 콤마에 의해 각 변수를 구분한다.
Value = undefined
In computer programs, variables are often declared without a value. The value can be something that has to be calculated, or something that will be provided later, like user input.
A variable declared without a value will have the value undefined.
The variable carName will have the value undefined after the execution of this statement:
컴퓨터 프로그램에서 볌수는 자주 값이 없이 선언된다.
변수는 계산되어진 어떤것일수 있고, 또는 후에 유저가 집어넣은것처럼 후에 제공되어질 수 있다.
변수는 값 없이 선언되어진 변수는 undefinded 값을 가질것이다.
carName변수는 이 문장의 끝난 후에 undefined 값을 가질것이다.
Re-Declaring JavaScript Variables
If you re-declare a JavaScript variable, it will not lose its value.
The variable carName will still have the value "Volvo" after the execution of these statements:
자바스크립트 변수 재선언
만일 너가 자바스크립트 변수를 재 선언 한다면, 이것은 값을 잃어버리지 않을 것이다.
carName변수는 아래의 문장이 끝난후에도 여전히 "Volvo" 값을 가질 것이다.
If you put a number in quotes, the rest of the numbers will be treated as strings, and concatenated.
만일 너가 쿼터 안에 숫자를 넣는다면, 숫자의 나머지 부분은 스트링을 다뤄질것이고, 문자열은 합쳐질것이다.
'영어공부' 카테고리의 다른 글
Guide to Java Versions and Features (0) | 2022.01.08 |
---|---|
JavaScript Data Types (0) | 2020.02.12 |
JavaScript Comments (0) | 2020.02.12 |
JavaScript Syntax (0) | 2020.01.23 |
JavaScript Statements (0) | 2020.01.23 |