I have a jsonArray something like this.
var json_array = [
{ "text": "id", "size": 4},
{ "text": "manifesto", "size": 4},
{ "text": "also", "size": 4},
{ "text": "leasing", "size": 4},
{ "text": "23", "size": 4},
...
];
I want to get first n elements of this json_array.
What will be the best way to do it? Apart from iterating them and having a counter to limit the size.
short hand (MDN Docu):
somewhat longer (MDN Docu):