Array.includes(value):返回一個布爾值,value是否在數組中
Array.indexOf(value):如果value在數組中,則返回value在數組中的下標;否則返回-1
當只想確定一下value是否在數組中時,可使用Array.includes()來替代Array.indexOf();
如下圖:
Array.includes(value):返回一個布爾值,value是否在數組中
Array.indexOf(value):如果value在數組中,則返回value在數組中的下標;否則返回-1
當只想確定一下value是否在數組中時,可使用Array.includes()來替代Array.indexOf();
如下圖:
(function(d, s, id) { let js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) retur