Blogger Information
Blog 77
fans 0
comment 2
visits 55684
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
代码优化-表驱动编程
南瓜又个梦
Original
494 people have browsed it

map,表,优化,优化的是什么:重复的if,else

  1. if(a){1}
  2. else if(b){2}
  3. else if(c){3}
  4. else if(d){4}
  5. else if(e){5}
  6. else if(f)6{}

优化

  1. const map=[a:1,b:2,c:3,d:4,e:5,f:6]
  2. function Q(key){
  3. return map[key]
  4. }
  5. const A=Q(a)
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post