I'm new to javascript.
(我是javascript新手。)
I have 2 arrays, how can I match them and return an HTML.(我有2个数组,如何匹配它们并返回HTML。)
If there are values matched in two arrays, the select option is disabled.(如果两个数组中有匹配的值,则禁用select选项。)
for example:(例如:)
var array1 = ["8:00AM", "9:00AM", "10:00AM","11:00AM",]
var array2 = ["11:00AM", "11:00AM", "3:00PM"]
array1.map((el, i) => <option key={i} disabled ={
el.includes(array2) ? true: false
}>{el}</option>))
what I would like to happen is if there are values matched between the 2 arrays, in this case "11:00AM", it would return:
(我想发生的是,如果两个数组之间有匹配的值,在这种情况下为“ 11:00 AM”,它将返回:)
<option> 8:00AM</option>
<option> 9:00AM</option>
<option> 10:00AM</option>
<option disabled = {true} > 11:00AM</option>
<option> 12:00PM</option>
something like this.
(这样的事情。)
Is this possible with my current method?(我目前的方法有可能吗?)
ask by Heisenberg translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…