Check if particular value is present in array or not

Hi everyone, I have an array example a=[1,2,3,4,5] I want to check if ‘4’ is present in array or not. I don’t want to use ‘do-while’ loop to do the same. I have used a function ‘includes()’ for this but its not giving any value in output as true or false. Do we have any other approach?

1 Like

@Prableen I tried using includes and it is working as expected (returning true) Please find below screenshot for reference.

2 Likes

Thanks for your response Kudlappa :slightly_smiling_face:

1 Like

We are glad we could assist @Prableen, please feel free to ask any more

1 Like