https://github.com/jasheloper/color-choices
Apply more color choices to a simple website.
https://github.com/jasheloper/color-choices
conditional-statements javascript
Last synced: 3 months ago
JSON representation
Apply more color choices to a simple website.
- Host: GitHub
- URL: https://github.com/jasheloper/color-choices
- Owner: jasheloper
- Created: 2023-10-18T01:19:34.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-18T01:40:09.000Z (over 1 year ago)
- Last Synced: 2023-10-18T02:29:40.431Z (over 1 year ago)
- Topics: conditional-statements, javascript
- Language: HTML
- Homepage: https://jasheloper.github.io/color-choices/
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
## Demo
https://jasheloper.github.io/color-choices/## Objective
In this example, you are going to take the ternary operator example we saw earlier and convert the ternary operator into a switch statement to allow us to apply more choices to the simple website.
Look at the `` — this time you'll see that it has not two theme options, but five.
- MDN Link: https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/conditionals#active_learning_more_color_choices
## Instructions
You need to add a switch statement just underneath the `// ADD SWITCH STATEMENT comment`:
- It should accept the `choice` variable as its input expression.
- For each case, the choice should equal one of the possible `` values that can be selected, that is, `white`, `black`, `purple`, `yellow`, or `psychedelic`.
- For each case, the `update()` function should be run, and be passed two color values, the first one for the background color, and the second one for the text color. Remember that color values are strings, so they need to be wrapped in quotes.