Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions index.js
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 ) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if( number < 400 ) {
if (number < 400) {

result = 'This one is on me!';
} else if (number > 400 && number < 2000 ) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to include the > 400 bit since the first part of the conditional covers that.

Suggested change
} else if (number > 400 && number < 2000 ) {
} else if (number < 2000 ) {

result = 'That will be twenty bucks.';
} else if (number >= 2001 && number < 2500 ) {
result = 'I will gladly take your thirty bucks.';
} else if (number > 2500) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same idea here.

Suggested change
} else if (number > 2500) {
} else {

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this works, you can simply return the ternary:

Suggested change
const message = city === 'NYC' ? "Ok, sounds good." : "No go.";
return message;
return city === 'NYC' ? 'Ok, sounds good.' : 'No go.;

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.'
}
}