Ad

"Undefined" On My Loop Trying To Fetch Object In Json File

Hi guys I'm having trouble in my for loop because there's a word "undefined" on the result of my loop, I'm trying to fetch objects on my json file and my loop works fine, I'm just wondering on how to remove the "undefined" word in my loop? thanks in advance.
here is the output

here is my code

and here is my json file

Ad

Answer

In your code, show variable before the loop is undefined, you haven't set some value for it, and using it without value. So, JavaScript can not identify the value of the variable and set it as "undefined"

Ad
source: stackoverflow.com
Ad