Search For

String Contains

Flag Hide Line Nos
Flagging a Snippet, takes the snippet to Moderator Attention;


0
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>
Vote! You feel this code is working like charm ? Go a head Login and Press up arrow.
Didn't work ?, press down arrow and let us know the error in comments

Comments

Train Time
Train Time - Live Train Status