technopeasant
technopeasant

Reputation: 7939

jQuery total amount of elements in an array

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

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

total = 3

Upvotes: 2

Views: 97

Answers (1)

VisioN
VisioN

Reputation: 145408

Property length specifies the number of elements in array:

var total = cookie.length;

Upvotes: 2

Related Questions