这两个语句的工作:
<% if(currentUser.collegeLevel === "High School") { %>
<h1> They have a High School Degree </h1>
<% } %>
<% if(currentUser.collegeLevel === "Associates Degree") { %>
<h1> They have an Associates Degree </h1>
<% } %>
此语句不工作
<% if(currentUser.collegeLevel === "Associates Degree" || "High School") { %>
<h1> They have either a High school or Associates Degree</h1>
<% } %>
为什么OR功能无法正常工作?
这是行不通的,因为或不反对别的比较..
它应该是这样的:
if(currentUser.collegeLevel === "Associates Degree" || currentUser.collegeLevel === "High School")