minor fixes
This commit is contained in:
parent
689975093c
commit
f6ff773033
24 changed files with 67 additions and 76 deletions
|
@ -10,7 +10,7 @@ if (userName == 'Admin') {
|
|||
if (pass == 'TheMaster') {
|
||||
alert( 'Welcome!' );
|
||||
} else if (pass == '' || pass == null) {
|
||||
alert( 'Canceled.' );
|
||||
alert( 'Canceled' );
|
||||
} else {
|
||||
alert( 'Wrong password' );
|
||||
}
|
||||
|
|
|
@ -6,13 +6,13 @@ importance: 3
|
|||
|
||||
Write the code which asks for a login with `prompt`.
|
||||
|
||||
If the visitor enters `"Admin"`, then `prompt` for a password, if the input is an empty line or `key:Esc` -- show "Canceled.", if it's another string -- then show "I don't know you".
|
||||
If the visitor enters `"Admin"`, then `prompt` for a password, if the input is an empty line or `key:Esc` -- show "Canceled", if it's another string -- then show "I don't know you".
|
||||
|
||||
The password is checked as follows:
|
||||
|
||||
- If it equals "TheMaster", then show "Welcome!",
|
||||
- Another string -- show "Wrong password",
|
||||
- For an empty string or cancelled input, show "Canceled."
|
||||
- For an empty string or cancelled input, show "Canceled"
|
||||
|
||||
The schema:
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ if (hour < 10 || hour > 18 || isWeekend) {
|
|||
}
|
||||
```
|
||||
|
||||
## OR finds the first truthy value
|
||||
## OR "||" finds the first truthy value
|
||||
|
||||
The logic described above is somewhat classical. Now, let's bring in the "extra" features of JavaScript.
|
||||
|
||||
|
@ -186,7 +186,7 @@ if (1 && 0) { // evaluated as true && false
|
|||
```
|
||||
|
||||
|
||||
## AND finds the first falsy value
|
||||
## AND "&&" finds the first falsy value
|
||||
|
||||
Given multiple AND'ed values:
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue