How to check that array values all are HTML files? If the array is not entirely strings ending in .html, I want to show an alert message and stop it. How can I do it?
https://jsfiddle.net/p57cjk81/2/
var arr = ["power.html", "sugar.html", "time.html", "kavi.html", "images.html"];
//var arr=["power.txt", "sugar.html", "time.html", "kavi.html", "images.html"];
var flag = true;
for (var i = 0; i <= arr.length; i++) {
if (arr[i].split(.) == ".html"){
flag = true;
} else {
flag = false;
}
}
if (flag) {
alert("Yes all the file have html");
} else {
alert("All file are not html");
}