Get size of Set

13 views
Skip to first unread message

Truc Nguyen Lam

unread,
Aug 9, 2013, 9:58:54 AM8/9/13
to jsclas...@googlegroups.com
Hi all,

I am using the JSClass for my project. I wonder if there is a way that I can get the size of a Set (the api I cannot find) and convert the Set into an array?

Cheers.

James Coglan

unread,
Aug 12, 2013, 5:49:43 AM8/12/13
to jsclas...@googlegroups.com
On 9 August 2013 14:58, Truc Nguyen Lam <trucng...@gmail.com> wrote:
I am using the JSClass for my project. I wonder if there is a way that I can get the size of a Set (the api I cannot find) and convert the Set into an array?

You should use the count() and toArray() methods from Enumerable: http://jsclass.jcoglan.com/enumerable.html 
Message has been deleted

Truc Nguyen Lam

unread,
Aug 12, 2013, 9:40:10 AM8/12/13
to jsclas...@googlegroups.com
Thank you. This library is absolutely cool.

James Coglan

unread,
Aug 12, 2013, 11:12:31 AM8/12/13
to jsclas...@googlegroups.com
On 12 August 2013 14:37, Truc Nguyen Lam <trucng...@gmail.com> wrote:
Thanks, how do I use the Enumerable or Enumerator modules? Is that using forEach() from Set?

Yep, just call set.forEach(function(item) { ... }) 
Reply all
Reply to author
Forward
0 new messages