Reputation: 32321
I have a JSON as shown below
var result = [
{
"SurCharges": "50"
},
{
"SurCharges": "50"
},
{
"SurCharges": "50"
}
]
As there are 3 elements present inside the result array
How can i get its length ??
I have tried it this way
But it isn't working
could anybody please help
alert(result[0].length);
Upvotes: 0
Views: 38
Reputation: 1485
you can use .lenght
var numberOfElements = result.length;
alert (numberOfElements);
Upvotes: 1