https://github.com/jasheloper/conditionals-test-1
Test skills with JavaScript conditionals.
https://github.com/jasheloper/conditionals-test-1
conditionals if-else javascript
Last synced: about 1 year ago
JSON representation
Test skills with JavaScript conditionals.
- Host: GitHub
- URL: https://github.com/jasheloper/conditionals-test-1
- Owner: jasheloper
- Created: 2023-10-18T01:46:18.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-24T01:02:44.000Z (over 2 years ago)
- Last Synced: 2023-10-24T02:27:52.727Z (over 2 years ago)
- Topics: conditionals, if-else, javascript
- Language: HTML
- Homepage:
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
## Exercise Link:
https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Test_your_skills:_Conditionals
## Instructions:
In this task you are provided with two variables:
`season` — contains a string that says what the current season is.
`response` — begins uninitialized, but is later used to store a response that will be printed to the output panel.
- We want you to create a conditional that checks whether season contains the string "summer", and if so assigns a string to response that gives the user an appropriate message about the season.
- If not, it should assign a generic string to response that tells the user we don't know what season it is.
- To finish off, you should then add another test that checks whether season contains the string "winter", and again assigns an appropriate string to response.
## My Solution:
```
// Add your code here
let season = 'summer';
let response;
if (season === 'summer') {
response = "Pack for the beach."
} else if (season === 'winter') {
response = "Stay inside and drink a hot beverage."
} else {
response = "Sorry. Season not found."
}
```