javascript - Do something if Array element starts with a certain letter -
this question has answer here:
- how check if string “startswith” string? 17 answers
(or not start letter) consider array:
myarray = ['m1','m2','a1']
and:
if ( myarray[1] !== *start m* ) { // };
is there selector can use?
thanks in advance.
if ( myarray[1].indexof('m') != 0)
code within if block execute if string not start 'm'
Comments
Post a Comment