function get_TRUTH ( array ){ for( var i = 0, TRUTH = 0; i < array.length ; i++ ){ if( typeof array[ i ] === "undefined" ) continue; TRUTH++; } return TRUTH; } var t = [1,2,3]; t.length = 333; alert ( get_TRUTH( t ) )