I have an array on JS containing numeric values:
var massiv = [ "100", "101", "456", "1000", "321" ] And there is a variable:
var peremennaya = "101" Task: if the variable matches one of the array values, then you need to perform an action. For example:
alert = "Нашлось 101" The array contains only numeric values, but they are wrapped in quotes for versatility, I think, that is, so that the script does not only compare values
== but also found letter matches.
If possible, I would like to see an example with explanations of each step in the form of comments or how convenient.
indexOf? - Alexey Shimansky