0

Why it is returning "false"

var ad=[0] var per=ad.includes() while(ad<5){ ad++ } document.write(per)

24th May 2021, 6:03 PM
Ashish Hojai
Ashish Hojai - avatar
2 Respostas
+ 2
line 2: the .includes() function doesn't have a required argument. It should be like array.includes(element)
24th May 2021, 6:11 PM
Isaac Fernandes
Isaac Fernandes - avatar
+ 2
Adding to Isaac, <ad> is an array, and its value can't be compared against a number such as while( ad < 5 ) And since <ad> was an array, it can't be incremented such as ad++;
25th May 2021, 3:27 AM
Ipang