Topics: The if keyword, if...else statements comparison operators logical operators, Truthy and falsy, Truthy and falsy assignment ternary operator, Else if statements, The switch keyword
- Create a html file with your name like john.html
- Add current code to that file:
<!DOCTYPE html>
<html>
<body>
<script>
// your code here
</script>
</body>
</html>
- Define variables for dog attributes:
- Size: Small
- Energy: Medium
- Height: 9 inches
Height is number.
- Recommend Dog Food based on this conditions:
- If Size is Small and Height < 9, Log "Food: Dry Dog Food"
- If Size is Medium or Height > 12, Log "Food: Dehydrated Dog Food"
- If Size is Big and Height >17 9, Log "Food: Raw Dog Food"
- If None of them, Log "Canned Dog Food"
- Define variables for dog breed:
- Breed: Affenpinscher
- Recommend Dog Food based on dog breed:
- If Affenpinscher, Log "Dry"
- If Akita, Log "Dehydrated"
- If Cesky Terrier, Log "Raw"
- If Chihuahua, Log "Canned"
Use switch case for this task.
Send Pull Request. Check how to deliver your code: https://codingwithbasir.com/how-to-deliver-projects/
Download Learn JavaScript eBook from https://codingwithbasir.com/learn-javascript