switch 语句
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>DEMO - Lik</title> </head> <body> <script> var total = 10; switch(total){ case 0: console.log('这是个0'); break; case 10: console.log('这是个10'); break; case 20: console.log('这是个20'); break; default: console.log('它什么都不是'); } </script> </body> </html>
最后控制台会输出:
author:Lik
Endeavoring to powerless, struggling to move yourself.
Endeavoring to powerless, struggling to move yourself.