원문보기

Don't Repeat Yourself (D.R.Y)
여러분 스스로 반복하지 마십시오.

The D.R.Y. principle is really important in programming. No repeating!
프로그래밍에서 스스로 반복하지 않는 것은 매우 중요합니다.

Any time you find yourself typing the same thing, but modifying only one small part, you can probably use a function.
어느때나 당신스스로 같은 것을 입력하기를 찾지만 당신이 아마도 사용할 수 있는 함수에서 수정할 부분은 단지 작은 영역이다.

The 'small part' that you find yourself modifying will be the parameter. And the part that you keep repeating will be the code in the reusable block - the code inside { }.
당신이 찾을 수 있는 수정 사항 작은 부분은 매개변수가 될 겁니다. 그리고 당신이 재반복 되도록 하는 부분은 재사용되는 블락안의 코드가 될 겁니다.

Instructions
지침

You are a creature of habit. Every week you buy 5 oranges. But orange prices keep changing!
당신은 습관에 지배 받습니다. 매주 5개의 오렌지를 삽니다만 오랜지 가격은 계속 바뀌고 있습니다.

01    You want to declare a function that calculates the cost of buying 5 oranges.
01    당신은 5개 오렌지를 사는 비용 계산하는 함수를 선언하길 원합니다.
 
02    You then want to calculate the cost of the 5 all together.
02    당신은 그러고나서 5개 전부 비용을 계산하길 원합니다.

03    Write a function that does this called orangeCost().
03    orangeCost()라고 불리는 함수를 작성하세요.

04    It should take a parameter that is the cost of an orange, and multiply it by 5.
04   오렌지 비용 매개변수를 사용하여 5를 곱해야 합니다.

05    It should log the result of the multiplication to the console.
05   곱한 결과는 콘솔사용하여 기록해야합니다.

06    Call the function where oranges each cost 5 dollars.
06   오렌지들 각 5달러 비용이 드는 것으로 함수를 호출하세요.


Hint
힌트

What is the one bit of input that changes each time? It would be the price. So give your parameter the name price. And when you call your function, put in a number for the price to see how much 5 oranges cost!
각각의 때마다 변경되어 입력되는 한 비트는 무엇입니까? 그것은 가격이 될 겁니다. 따라서 당신의 매개변수에 이름 가격을 제공합니다. 그리고 당신의 함수를 호출할 때, 5개의 오렌지의 비용이 얼마인지 볼수 있도록 가격의 숫자를 입력하세요.


var orangeCost = function (price) {
console.log(5 * price);
}
orangeCost(5);


Posted by 뭔가느낌이
,
원본 http://www.codecademy.com/courses/javascript-beginner-en-6LzGd/0/5?curriculum_id=506324b3a7dffd00020bf661

Tying it all together
함께 묶기

Why is the code organized like it is on lines 2-5?
왜 2-5줄처럼 코드를 구성할까?

The computer can understand the code without such spacing. But it makes editing a lot easier and is best practice.
컴퓨터는 공백없이 코드를 이해할 수 있다. 하지만 훨씬 쉽게 편집하게 하고 좋습니다.

Do I have to put a semi-colon at the end of each line of code in the reusable block? And at the end of the entire function?
재사용 가능한 블록 코드의 각 줄 끝에 세미콜론을 넣어야 합니까?그리고 전체 함수 끝에도 넣어야 합니까?

Yes. At the end of each line of code (within the { }) and after the entire function (after the { }), please put a semi-colon. The semi-colon acts like a period in a sentence. It helps the computer know where there are stopping points in the code.
그렇습니다. 코드의 마지막({ 내에서) 그리고 전체 함 수 끝에 ({} 다음에) 세미콜론을 넣어주세요. 세미콜론은 문장의 마침과 같이 역할 합니다. 컴퓨터가 코드의 마침점이 어디인지 알 수 있게 도와줍니다.

Instructions
지침문

A big part of programming is debugging. That just means figuring out what the heck went wrong with your code. Why didn't it run?
프로그래밍의 하나의 큰 부분은 디버기입니다. 그건 당신의 코드에서 무엇이 잘못되었는지 알려주는 것을 말합니다. 왜 그게 실행되지 않을까요?

01.  Look at line 9. It has many syntax errors. See how lack of spacing makes debugging hard?
01. 9번 줄을 보세요.구문 오류가 많이 있죠. 간격의 적음이 디버깅을 어렵네 만드는 것이 보이나요?

02.  Fix the function on line 9. Make sure the syntax is right. Make sure it looks nice.
02. 9번줄을 수정하세요. 구문에 맞는지 확인하세요. 보기 좋게 만드세요.

03. Call the greeting function once it is fixed! Don't forget to pass in a specific name.
03. 인사 함수를 부르는 것이 수정되었습니다. 특정 이름을 전달하는 것을 잊지 마세요.


Posted by 뭔가느낌이
,

원문 http://www.codecademy.com/en/tracks/javascript


JavaScript
 Learn the fundamentals of JavaScript, the programming language of the Web.
자바 스크립트, 웹 프로그래밍 언어의 기초를 배웁니다.

5m+
enrolled students
500백만 이상의 학생이 배움

10 Hours
estimated course time
모두 학습하는데 10시간 예상

Beginner
required technical level
필요한 기술 수준은 초급

 
Introduction to JavaScript
자바스크립트 소개
codestudy_javascript01
Getting Started with Programming
프로그래밍시작하기
Choose Your Own Adventure!
모험을 시작하십시오

Functions
함수
Introduction to Functions in JS
자바스크립트 함수를 소개합니다.
Build "Rock, Paper, Scissors"
가위바위보 빌드

'For' Loops in JavaScript
자바 스크립트의 'for'루프
Introduction to 'For' Loops in JS
JS에서 'for'루프 소개
Search Text for Your Name

여러분의 이름을 검색해봅시다

'While' Loops in JavaScript

자바스크립트에서 'While'반복문
Introduction to 'While' Loops in JS

자바스크립트에서의 'While'반복문 소개

Dragon Slayer!

드래곤슬레어어~!


Control Flow

제어문
More on Control Flow in JS

자바스크립트에서 제어문 자세히 알아보기
Choose Your Own Adventure 2!

여러분의 모험2를 선택하세요


Data Structures

자료구조
Arrays and Objects in JS

자바스크립트 내 배열과 개체
Contact List

Objects I
Introduction to Objects I
Building an Address Book

Objects II
Introduction to Objects II
Building a Cash Register

Posted by 뭔가느낌이
,