Setting Variables Using Switch Statements In JavaScript
Jan 19, 2021 · 2 min read · Here is a snippet showing an example of how this would be done. Each animal has a favorite color which we will determine using a switch statement. const animal = "dog"; const color = (()=>{ switch (animal) { case "cat": retur...
Join discussion



