$$(".myclass").length
It is necessary to resolve the promise to get the length of the element correctly.
$$(".myclass").count()
A wrapper for $$('.myclass').length , which in itself is a promise and does not require resolution of the promise as .length
$$(".myclass").count();
which one is preferable?
If when placing $$(".myclass") and .then(function(items){...}) there is no complicated business, then items.length will give better performance. Otherwise, you should always use $$(".myclass").count() .
source share