Advertisement
Guest User

Untitled

a guest
Apr 24th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //special for hcdev
  2.  
  3. const oldSwitch = (type) => {
  4.     switch(type) {
  5.     case 'react':
  6.         return 'react'
  7.     case 'vuejs':
  8.         return 'vuejs'
  9.     default:
  10.         return ''
  11.   }
  12. }
  13.  
  14. oldSwitch('react')
  15.  
  16. const objLiteral = (type) => {
  17.   const value = {
  18.     'react': () => 'react',
  19.     'vuejs': () => 'vuejs',
  20.     'default': () => ''
  21.   }
  22.   return (value[type] || value["default"])()
  23. }
  24.  
  25. objLiteral('react')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement