-
Notifications
You must be signed in to change notification settings - Fork 10.2k
Complete Lab #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Complete Lab #16
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -1,11 +1,29 @@ | ||||||||
| function scuberGreetingForFeet(){ | ||||||||
| // Write your code here! | ||||||||
| function scuberGreetingForFeet(number){ | ||||||||
| let result | ||||||||
| if( number < 400 ) { | ||||||||
| result = 'This one is on me!'; | ||||||||
| } else if (number > 400 && number < 2000 ) { | ||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You don't need to include the
Suggested change
|
||||||||
| result = 'That will be twenty bucks.'; | ||||||||
| } else if (number >= 2001 && number < 2500 ) { | ||||||||
| result = 'I will gladly take your thirty bucks.'; | ||||||||
| } else if (number > 2500) { | ||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same idea here.
Suggested change
|
||||||||
| result = 'No can do.'; | ||||||||
| } | ||||||||
| return result; | ||||||||
| } | ||||||||
|
|
||||||||
| function ternaryCheckCity(){ | ||||||||
| // Write your code here! | ||||||||
| function ternaryCheckCity(city){ | ||||||||
| const message = city === 'NYC' ? "Ok, sounds good." : "No go."; | ||||||||
| return message; | ||||||||
|
Comment on lines
+16
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While this works, you can simply return the ternary:
Suggested change
Also, try to be consistent with using either single and double quotes, but not both. |
||||||||
| } | ||||||||
|
|
||||||||
| function switchOnCharmFromTip(){ | ||||||||
| // Write your code here! | ||||||||
| function switchOnCharmFromTip(tip){ | ||||||||
| switch(tip) { | ||||||||
| case 'generous': | ||||||||
| return 'Thank you so much.'; | ||||||||
| case 'not as generous': | ||||||||
| return 'Thank you.'; | ||||||||
| default: | ||||||||
| return 'Bye.' | ||||||||
| } | ||||||||
| } | ||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.