Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
389 views
in Technique[技术] by (71.8m points)

javascript - 如果输入a或b是正确/正确,如何执行动作? [重复](How can I execute an action if either input a or b is correct/true? [duplicate])

A user writes 'football' into my input bar and then the action on line 6 and 7 executes.(用户将“足球”写入我的输入栏中,然后执行第6行和第7行的操作。)


But I what if the user writes "Football", with a capital letter?(但是,如果用户用大写字母写“足球”怎??么办?) I tried to implement the "logial or" ||(我试图实现“逻辑或” ||) but I couldn't get it to work.(但我无法正常工作。) var input = document.getElementById("user_input"); let footballTeams = ["Manchester","Barcelona","Copenhagen"] if (input.value == "football") { alert("These cities have football teams:" + " " + footballTeams[0] + "," + " " + footballTeams[1] + "," + " " + footballTeams[2])   ask by Julius Nicolet Nielsson translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

Please log in or register to answer this question.

Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...