Assessment wanted for JSON1 skill test

Hi,
What is a better way than this? I still need a lot of practice in looping and I struggled accessing the object properties while doing this. A Pen by Christian Barrameda (codepen.io)
Thank you very much.
Keep it up.
Burds

Hi @Burds

Your code looks already very good. The choice for the traditional for loop to use the index and the modern for...of loop for the kittens is fine.

Something that’s not quite correct is the calculation of total. Every time the inner loop runs you count the letters of the kitten’s name. Coincidentally, the name of the last kitten (Randolph) has exactly as many letters as there are kittens. So while the result is correct, the calculations isn’t. :grin:
You could simply do total++; instead of total = kit.name.length; to count every kitten.

The calculations of female kittens can be done when we finished the loops, directly inside kittenInfo: ${total - male}. No need for a separate variable female.

Let me know if you need more help. :slightly_smiling_face:

Michael