Chris Pietschmann

husband, father, hacker, entrepreneur, futurist, innovator, autodidact


JavaScript Basics: String Contains Function

In many of the server-side programming languages like C#, the String object has a "Contains" method that returns a boolean indicating if the string contains another specified string. JavaScript however does not have a ".contains" method. Fortunately, the ".indexOf" method in JavaScript can easily be used to mimic or build your own ".contains" method. Simple JavaScript String Contains Method Here's a simple implementation of a ".contains" function that is case sensitive: function contains(value, ... [More]