Skip to main content
readability
Source Link
Popnoodles
  • 28.4k
  • 3
  • 47
  • 55

Just search for the string in plain old indexOf

arr.forEach(function(a){
    if (typeof(a) == 'string' && a.indexOf('curl')>-1) {
            console.log(a);
    }        
});

Just search for the string in plain old indexOf

arr.forEach(function(a){if (typeof(a) == 'string' && a.indexOf('curl')>-1) console.log(a);})

Just search for the string in plain old indexOf

arr.forEach(function(a){
    if (typeof(a) == 'string' && a.indexOf('curl')>-1) {
            console.log(a);
    }        
});
Added check for string only elements
Source Link
JohnnyJS
  • 1.4k
  • 13
  • 24

Just search for the string in plain old indexOf

arr.forEach(function(a){if (typeof(a) == 'string' && a.indexOf('curl')>-1) console.log(a);})

Just search for the string in plain old indexOf

arr.forEach(function(a){if (a.indexOf('curl')>-1) console.log(a);})

Just search for the string in plain old indexOf

arr.forEach(function(a){if (typeof(a) == 'string' && a.indexOf('curl')>-1) console.log(a);})
Source Link
JohnnyJS
  • 1.4k
  • 13
  • 24

Just search for the string in plain old indexOf

arr.forEach(function(a){if (a.indexOf('curl')>-1) console.log(a);})