Closed
Description
This issue is for discussion and assignment for the resistor-color
core exercise in the javascript
track.
🔗 implementation | mentor-notes | problem-specification
This exercise introduces the student to Arrays
as well as showing that you
can export multiple bindings at once. Solutions using an Object
will actively be discouraged as speed is not a good reasoning here.
Optimal solution(s)
export const COLORS = [
'black', 'brown', 'red', 'orange', 'yellow', 'green',
'blue', 'violet', 'grey', 'white',
];
export const colorCode = color => COLORS.indexOf(color)
Approvable alternatives are:
- using an arrow function expression
SHOULD comment and disapprove
Cases we SHOULD comment on with this analyzer:
- Manually doing indexOf
- A set of conditionals or a switch
- Using the obscure
bind
to bindArray.prototype.indexOf
COULD comment (tips)
Cases we COULD comment on with this analyzer:
- Doing an
export
with a specifier (at the bottom of the file) can be doneexport const
inline
Metadata
Metadata
Assignees
Labels
No labels