Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //special for hcdev
- const oldSwitch = (type) => {
- switch(type) {
- case 'react':
- return 'react'
- case 'vuejs':
- return 'vuejs'
- default:
- return ''
- }
- }
- oldSwitch('react')
- const objLiteral = (type) => {
- const value = {
- 'react': () => 'react',
- 'vuejs': () => 'vuejs',
- 'default': () => ''
- }
- return (value[type] || value["default"])()
- }
- objLiteral('react')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement