-
Notifications
You must be signed in to change notification settings - Fork 7
Hadid w2 javascript #24
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: main
Are you sure you want to change the base?
Hadid w2 javascript #24
Conversation
dardecena
left a comment
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.
Good work! Let's go over exercise 2 together some time this week.
| // TODO substitute your own name for "HackYourFuture" | ||
| const myName = 'HackYourFuture'; | ||
|
|
||
| const myName = "HackYourFuture"; |
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.
Don't forget to read the requirements. It asks here to replace "HackYourFuture" with your name.
| export function calculateDogAge(humanYears) { | ||
| return humanYears * 7; |
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 try. You are almost there.
Take another look at the requirements, the function should return a string. What does your function 'calculateDogAge' return?
| const myAge = 25; | ||
| console.log( | ||
| `If you are ${myAge} years old, that's ${calculateDogAge(myAge)} in dog years!` | ||
| ); | ||
|
|
||
| const yourAge = 40; | ||
| console.log( | ||
| `If you are ${yourAge} years old, that's ${calculateDogAge(yourAge)} in dog years!` | ||
| ); |
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.
This is not necessary, the function 'calculateDogAge' should return the console.log(). Think about the string that is the expected result, and where in the code it should be triggered.
| const numKids = [0, 1, 2, 3, 4]; | ||
| const partnerNames = ["Alex", "Sam", "Taylor", "Jordan", "Casey"]; | ||
| const locations = ["Amsterdam", "Rotterdam", "Utrecht", "The Hague", "Eindhoven"]; | ||
| const jobTitles = ["developer", "designer", "teacher", "engineer", "chef"]; |
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.
👍
| export function tellFortune(numKids, partnerNames, locations, jobTitles) { | ||
| return `You will be a ${selectRandomly(jobTitles)} in ${selectRandomly( | ||
| locations | ||
| )}, married to ${selectRandomly(partnerNames)} with ${selectRandomly( | ||
| numKids | ||
| )} kids.`; |
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 selectRandomly(arr) { | ||
| return arr[Math.floor(Math.random() * arr.length)]; |
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.
👍
dardecena
left a comment
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.
Great job Rim. Thanks for making the corrections
|
|
||
| function main() { | ||
| const myName = "HackYourFuture"; | ||
| const myName = "Rim"; |
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.
👍
| console.log(giveCompliment(myName)); | ||
|
|
||
| const yourName = "Amsterdam"; | ||
| const yourName = "Hadid"; |
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.
👍
| const dogYears = humanYears * 7; | ||
| return `Your doggie is ${dogYears} years old in dog years!`; |
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.
👍
| console.log(calculateDogAge(1)); | ||
| console.log(calculateDogAge(2)); | ||
| console.log(calculateDogAge(3)); |
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.
👍
No description provided.