Access index property of JSON in javascript using a variable : The api that i am messing with has a limit of 100 items per request. So I am trying to find out the length variable (which works) but why cant i use that variable to get the index. like below.

       const ttl = results.data.length;
	   ttl = parseInt(l);
	   const s = results.data[ttl].id;

`ttl` does not work. But if i do the following...

	   const s = results.data[100].id;
the value is recognized fine... But i dont know what the length will be so i need to set it in a var and try to navigate through the JSON with the length var?