We all know IIFE. In fact we can do the same with objects to omit cumbersome if/else, switch/case.
const color = {
red: 'rgb(255, 0, 0)',
green: 'rgb(0, 255, 0)',
blue: 'rgb(0, 0, 255)'
}[props.color || 'red']
We all know IIFE. In fact we can do the same with objects to omit cumbersome if/else, switch/case.
const color = {
red: 'rgb(255, 0, 0)',
green: 'rgb(0, 255, 0)',
blue: 'rgb(0, 0, 255)'
}[props.color || 'red']
For further actions, you may consider blocking this person and/or reporting abuse
Parsa Frahani -
dev.to staff -
Bosco Domingo -
Tufail Shah -
Top comments (1)
this is fun π