2

Seems like a simple thing but I cant find anything on it!

var cookie = [1,2,3],
    total  = cookie.magicMethodThatICantFindThatTotalsTheElements();

total = 3
4

1 回答 1

2

Property length specifies the number of elements in array:

var total = cookie.length;
于 2012-10-21T19:13:14.170 回答