Q:

Detect if array has only null values in it

I have an array and I would like a simple non-loop test if that arrays contains ONLY null values. Empty array also counts as having only null values.
I guess another way to describe the issue is to test if the array has at least one non-null value.
So:
Good: [ null, null, null ]
Good: []
Bad:  [ null, 3, null ]

A:

You can avoid using an explicit loop by using Array#every:
var all_null = arr.every(function(v) { return v === null; });

but of course internally the engine will still iterate over the array.  Iterating over the array explicitly might actually be faster. The important thing to do is break out of the loop once you encounter an element which is not null (the method does that).
This method is not supported in every browser, see the link for a polyfill.

A:

The easiest way I can think of is a simple:
Array.prototype.isNull = function (){
    return this.join().replace(/,/g,'').length === 0;
};

[null, null, null].isNull(); // true
[null, 3, null].isNull(); // false

JS Fiddle demo.
This takes the array, joins the elements of that array together (without arguments join() joins the array elements together with , characters) to return a string, replaces all the , characters in that string (using a regular expression) with empty strings and then tests if the length is equal to 0. So:
[null, 3, null].isNull()

Joined together to give:
',3,'

Has all the commas replaced (using the g flag after the regular expression), to give:
'3'

Tested to see if its length is equal to 0, to give:
false

It's worth noting that there is the problem of, potentially, the , featuring in the checked arrays.
Also, Felix Kling's answer is somewhat faster.

A:

var arrayData1 = [null, null, null];
var arrayData2 = [];
var arrayData3 = [null, 3, null];
var arrayData4 = [3];

function isNull(inputArray) {
    if (inputArray.length) {
        var currentElement = inputArray[0];
        for (var i = 1, len = inputArray.length; i < len && currentElement === null; i += 1) {
            currentElement = currentElement || inputArray[i];
        }
        if (currentElement !== null) {
            return false;
        }
    }
    return true;
}

console.log(isNull(arrayData1));
console.log(isNull(arrayData2));
console.log(isNull(arrayData3));
console.log(isNull(arrayData4));

Output
true
true
false
false

Edit 1: And here comes the most efficient solution (suggested by user2736012). This solution applies KISS principle. K eep I t S imple, S illy.
function isNull(inputArray) {
  for (var i = 0, len = inputArray.length; i < len; i += 1)
    if (inputArray[i] !== null)
      return false;
  return true;
}

Performance Result: http://jsperf.com/so-q-19337761/6

