June 2018
Beginner
288 pages
6h 31m
English
Here are the solutions to the Exercises, for the Chapter 1, JavaScript Gotchas chapter.
| | return //undefined |
| | 2 * 3; |
| | |
| | return 2 //6 |
| | * 3; |
| | |
| | return 2 * 3 //6 |
| | ; |
| | //That's one strange comparison, but given the choices, choose === |
| | "2.0" / 2 * "2.0" === 2 / 2 * 2; |
| | 'use strict'; |
| | |
| | const canVote = function(age) { |
| | if(age === 18) { |
| | return 'yay, start voting'; |
| | } |
| | |
| | if(age > 17) { |
| | return "please vote"; |
| | } |
| | |
| | return "no, can't vote"; |
| | }; |
| | console.log(canVote(12)); //no, can't vote |
| | console.log(canVote("12")); //no, can't vote |
| | console.log(canVote(17)); //no, can't vote |
| | console.log(canVote('@18')); //no, can't vote |
| | console.log(canVote(18)); ... |
Read now
Unlock full access