JavaScript | 자바스크립트 | INTRODUCTION TO JAVASCRIPT 세번째

JavaScript | 자바스크립트 | INTRODUCTION TO JAVASCRIPT 세번째

Getting Started with Programming | Codecademy
Time to become a coding champ.


 Three. Make the computer think! 
12/28 Using console.log
File1 _ script.js
console.log(2 * 5)
console.log("Hello")

13/28 Comparisons
File1 _ script.js
// Here is an example of using the greater than (>) operator.
console.log(15 > 4); // 15 > 4 evaluates to true, so true is printed.

// Fill in with >, <, === so that the following print out true:
console.log("Xiao Hui".length < 122);
console.log("Goody Donaldson".length > 8);
console.log(8*2 === 16);


14/28 Decisions, decisions
File1 _ script.js
if ( "JONE STUDIO".length >= 7 ) {
    console.log("You have a long name!");
}

15/28 Computers are smart
File1 _ script.js
if ("JONE".length >= 7 ) 
{
    console.log("Let's go down the first road!");
}
else 
{
    // What should we do if the condition is false? Fill in here:
    console.log("You have a short name!");
}

16/28 More practice with conditionals
File1 _ script.js
// Remember, the order and punctuation matter.
// If you get an error, check carefully, line by line.
// If you're really stuck, click "Stuck? Get a hint!"
if ("JONE".length > 5) {
    console.log("The condition is true");
} else {
    console.log("The condition is false");
}

17/28 Computers aren't that smart
File1 _ script.js
// The computer doesn't worry about extra spaces between words or brackets
// It just cares about the order of where things are placed
// and that you have used the right characters (){}[]"";

// For extra help, a program called a 'linter' is checking your code
// and will put a red 'x' next to the first line that contains errors

if (10 === 10) {
    console.log("You got a true!");
} else {
    console.log("You got a false!");
}