boutique replica bags up ideas

the best replique rolex and prices here.

julia highlight 99j hair color 10a quality straight human hair lace front wigs 8 - 24 inches pre plucked hairline 13x4 inches lace front brazilian wig onlinefor sale

Check if string contains specific character in Javascript

Updated on     Kisan Patel

This tutorial will show you how to check if string contains specific character using javascript?

To check if string contains specific character, we need to use javascript string indexOf() method that returns the position of the first occurrence of a specified value in a string.

The indexOf() method returns -1 if the value to search for never occurs.

<script type="text/javascript" >
function TestFunction() {
 var str = "Hello world- welcome to the universe.";
 if(str.indexOf("e") === -1)
 {
    alert("No dash found!");
 }
 else
 {
    alert("dash found!");
 }
}
</script>

<p>Click the button to find characters in a given string.</p>
<button onclick="TestFunction()">Click me</button>

See the Pen zGbydQ by Kisan (@pka246) on CodePen.


JavaScript

Leave a Reply