Use indexOf to check if string contains a substring - Node.js String

Node.js examples for String:sub string

Description

Use indexOf to check if string contains a substring

Demo Code

String.prototype.contains = function(txt)
{
    return (this.indexOf(txt) >= 0);
}

Related Tutorials