COURSE · 10 chapters · 89 lessons
JavaScript
Build the way of thinking that programming runs on
Read about this chapter
Show text and numbers
- 02Text and numbers are different thingsWrapped in " it is text, left bare it is a number. Learn to tell them apart.Go to the exercises
- 05Joining text togetherThe same + adds numbers up but joins strings. Let us see it happen.Go to the exercises
Give a value a name
- 07Why bother with variablesReuse a value, say what it means, and keep the edit in one place. Feel the three things a variable gives you.Go to the exercises
- 08Changing what is in a variablePut a different value into a variable you already made.Go to the exercises
- 11Dropping a variable into some textUse a backtick and ${} to write something easier to read than a chain of +.Go to the exercises
Branch on a condition
- 12Doing something only ifUse if to write code that only runs when a condition holds.Go to the exercises
- 13true and falseA condition is really just a value: true or false. See for yourself that comparing gives you one back.Go to the exercises
- 14Checking whether two things are the sameUse === for "the same" and !== for "not the same".Go to the exercises
- 15Writing the "otherwise" partUse else to say what happens when the condition does not hold.Go to the exercises
- 16Splitting three ways or moreLine up else if and let the conditions be tried from the top.Go to the exercises
- 17Combining conditionsFold several conditions into one with && (and), || (or) and ! (not).Go to the exercises