Congratulations you have completed the Javascript module 😎.
You have covered some of the core fundamentals of Javascript and also how to start thinking about breaking problems down programmatically.
To give you a head start with this thinking and to get you to practice writing Javascript we have some challenges below we would like you to complete.
- We would like this project to be pushed to GitHub.
- We will review the challenge when the course starts.
- If you get stuck, thats okay. Reach out to a coach on Slack.
- Write a function that takes a number and returns true if it is a positive number and false if it is a negative number.
isNumberPositive(-1); // returns false
isNumberPositive(10); // returns true
- Write a function that takes a number of days and converts it into an age.
convertDaysToAge(3650); // returns 10
convertDaysToAge(6570); // returns 18
- Write a function that takes three numbers and returns the largest of the three numbers.
getLargestNumber(2 ,1, 4); // returns 4
getLargestNumber(6,2,3); // returns 6
- Write a function that takes an array of names and returns the last name from the array of names.
getLastName([”Charlie”, “Rob”, “Andy”]); // returns “Andy”
getLastName(["Ash","Stu"]); // returns "Stu"
- Write a function that takes an array of numbers and returns true if all of the numbers are positive. It should return false if there are one or more negative numbers in the array.
allNumbersPositive([2,4,5]); // returns true
allNumbersPositive([-5,4,6]); // returns false