switch 语句和 if-else 语句都是用于根据条件执行不同代码块的控制结构,但在某些情况下,switch 语句可能更具优势。以下是 switch 语句优于 if-else 语句的一些优点: 基础概念 if-else 语句:根据一个或多个条件执行不同的代码块。每个条件都需要用 if 或else if 进行判断。 switch 语句:根据一个表达式的值
if ( isAdmin === true) There's some good information here:https://stackoverflow.com/questions/359494/which-equals-operator-vs-should-be-used-in-javascript-comparisonsif you'd like to read about why. Secondly, check your syntax after your else if statement. You have the opening curly brace...