JavaScript | 자바스크립트 | 'WHILE' LOOPS IN JAVASCRIPT
JavaScript | 자바스크립트 | 'WHILE' LOOPS IN JAVASCRIPT
Introduction to 'While' Loops in JS | Codecademy
'While' loops are like 'for' loops, only they don't need a counter - they continue to run until their condition is met. | loop의 끝을 모른다면, 'While' loop!
1/11 While we're at it
File1 _ script.js
var coinFace = Math.floor(Math.random() * 2);while(coinFace === 0){
console.log("Heads! Flipping again...");
var coinFace = Math.floor(Math.random() * 2);
}
console.log("Tails! Done flipping.");
2/11 While syntax
File1 _ script.js
var understand = true;
while( understand ){
console.log("I'm learning while loops!");
understand = false;
}
| while syntax에서 ()의 condition을 채워넣는 course. 찍다시피 ()안에 understand만 썼는데 왜 PASS인지 모르겠네요. 그래도 일단 Go Go!
3/11 A fellow of infinite loops
File1 _ script.js
understand = true;
while(understand){
console.log("I'm learning while loops!");
//Change the value of 'understand' here!
understand = false;
}
4/11 Brevity is the soul of programming
File1 _ script.js
var bool = true;
while(bool){
console.log("Less is more!");
bool = false;
}
| Brevity 짧음, 간결함
Two. More Practice with Loops!
5/11 Practice makes perfect
File1 _ script.js
//Remember to set your condition outside the loop!
var count = 0;
var loop = function(){
while(count<3){
//Your code goes here!
console.log("I'm looping!");
count++;
}
};
loop();
| 어려워서 컨닝했습니다.
6/11 Solo flight
File1 _ script.js
//Remember to make your condition true outside the loop!
var condition = true;
var soloLoop = function(){
//Your code goes here!
while (condition) {
console.log("Looped once!");
condition = false;
}
};
soloLoop();
7/11 Mid-lesson breather
File1 _ script.js
Three. More with 'While'
8/11 When to 'while' and when to 'for'
File1 _ script.js
var myCondition = true;
while (myCondition) {
console.log("Hello JONESTUDIO!");
myCondition = false;
}
for (var i = 0; i < 11; i++) {
console.log(i);
}
9/11 The 'do' / 'while' loop
File1 _ script.js
var loopCondition = false;
do {
console.log("I'm gonna stop looping 'cause my condition is " + loopCondition + "!");
} while (loopCondition);
10/11 To learn it, you gotta 'do' it
File1 _ script.js
var getToDaChoppa = function(){
// Write your do/while loop here!
var myCondition = false;
do {
console.log("Hello, JONESTUDIO!");
} while (myCondition);
};
getToDaChoppa();
11/11 Review
File1 _ script.js
for (var i = 1; i<6; i++) {
console.log("JONE STUDIO " + i);
}
var myCon = true;
while (myCon) {
console.log("HELLO, JONE STUDIO!");
myCon = false;
}
var myCondition = false;
do {
console.log("Bye bye.");
} while (myCondition);
다들 재밌다고 해서 찾아본 영화, 월터의 상상은 현실이 된다 | The Secret Life of Walter Mitty를 보다가 눈에 띈 글귀입니다. 그냥 살아갈 것이 아니라 삶의 의미에 대해 가끔 한번씩 생각해보면서 사는 건 정말 중요하죠.
TO SEE THE WORLD, THINGS DANGEROUS TO COME TO,
TO SEE BEHIND WALLS, TO DRAW CLOSER,
TO FIND EACH OTHER AND TO FEEL.
THAT IS THE PURPOSE OF LIFE.
세상을 보고, 무수한 장애물을 넘어, 벽을 허물고, 더 가까이 서로를 알아가고 느끼는 것.
그것이 바로 우리 인생의 목적이다.

