Same as your other thread. A composite is not an array. You can test the elements property length though.

var len = ds.elements.length;