String Contains in JavaScript

Contains cannot be directly implement in javascript, however the desired result can be obtained using indexOf method

<script type='text/javascript'>
var s = "foo";
if(s.indexOf("oo") != -1){
    document.write("String contains oo");
}
else{
    document.write("String does not contain oo");
}
</ script>