var arr = [1,2,null,3,,4,5];
var summ = 0;
function s(x){
var sum = 0;
summ += x * x;
return sum += x*x;
};
for(var keys = 0;keys<arr.length;keys++){
if(!arr[keys]) continue;
var xx = arr[keys];
alert('Summa = ' + s(xx));
};
alert('Summa elementov massiva = ' + summ);