DEV Community

Discussion on: Change your old methods for writing a JavaScript Code - Shorthand's for JavaScript Code

Collapse
 
mikcat profile image
mikcat

Be careful if you refactor switch by object, because switch uses strict uses strict comparison ===.

console.log(data['1']); will return 'Case one' but switch('1') will jump to the default branch.