window.onbeforeunload = function () {
return "You work will be lost.";
};
return "You work will be lost.";
};
//random number from 1 to Nvar random = Math.floor(Math.random() * N + 1); |
function removeByValue(arr, val) { for(var i=0; i<arr.length; i++) { if(arr[i] == val) { arr.splice(i, 1); break; } }}var somearray = ["mon", "tue", "wed", "thur"]removeByValue(somearray, "tue");//somearray will now have "mon", "wed", "thur"function removeByIndex(arr, index) { arr.splice(index, 1);}test = new Array();test[0] = 'Apple';test[1] = 'Ball';test[2] = 'Cat';test[3] = 'Dog';alert("Array before removing elements: "+test);removeByIndex(test, 2);alert("Array after removing elements: "+test);