How to get the number of elements in an array? I mean array size.

kutvaram
Tera Expert

Hi All,

I am using arrayName.length to get the number of elements in an array.

But result not seems right.

What is the best way to get the count of the array elements?

Is there anyother method?

Thanks & Regards,

Ram Prakash

6 REPLIES 6

Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi,

 

How are you pushing elements in this array first let me know that.


We use arrayName.length only to check its length.


Thanks,
Ashutosh Munot

Hi Ashutosh,

 

It is list collector variable where we can select multiple values from left hand side to right hand side.

 

I am getting the selected values in an array and want to find its length. But somehow the method "length" not seems to be working. Instance is in Jakarta version.

what is the next best way to find the array length?

Thanks & Regards,

Ram Prakash

HI,


Ohk do one thing.

 

Split it by ','

 

var abc = arrayName.split(',');

var len = abc.length;

 

Or will pushing the details to array use .toString and then use arrayName.length

 

Thanks,
Ashutosh Munot

saurav1
Kilo Expert

Try using arrayname.toString().length;