Menghitung berapa kali string ada di string lain

var temp = "This is a string.";
alert(temp.split('is').length-1);
Moses Jespar