-
Notifications
You must be signed in to change notification settings - Fork 9.7k
More Functions #35
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?
More Functions #35
Conversation
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.
Nice!
function saturdayFun(activity = "roller-skate") { | ||
switch (activity) { | ||
case "bathe my dog": | ||
activity = "bathe my dog"; | ||
} | ||
return `This Saturday, I want to ${activity}!`; | ||
} |
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.
I think this would also pass the test:
function saturdayFun(activity = "roller-skate") { | |
switch (activity) { | |
case "bathe my dog": | |
activity = "bathe my dog"; | |
} | |
return `This Saturday, I want to ${activity}!`; | |
} | |
function saturdayFun(activity = "roller-skate") { | |
return `This Saturday, I want to ${activity}!`; | |
} |
switch (activity) { | ||
case "work from home": | ||
activity = "work from home"; | ||
} |
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.
Same idea here.
function wrapAdjective(string = "*") { | ||
const innerFunction = function (adjective = "special") { | ||
return `You are ${string}${adjective}${string}!`; | ||
}; | ||
return innerFunction; | ||
} |
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.
function wrapAdjective(string = "*") { | |
const innerFunction = function (adjective = "special") { | |
return `You are ${string}${adjective}${string}!`; | |
}; | |
return innerFunction; | |
} | |
function wrapAdjective(string = "*") { | |
return function (adjective = "special") { | |
return `You are ${string}${adjective}${string}!`; | |
}; | |
} |
Created 3 different types of functions including: function, function expression and Function-Level Scope.