Blog Archives


To check a string exists in other string in JavaScript, we can use indexOf function, if exists this function return 》=0 value,otherwise it will return -1.

For example:

if(str.indexOf(substr)>=0){

// exist

} else{

// not exist

}

3 Steps to run javascript in html


If you are studying javascript, you may want to know have to run it in html, you can do like this.

Step 1: Create a html file

You can create a html file by dreaweaver, TxtEdito or editplus, which named ‘test.html’, then open it.