Please assess JSON skill test - Thank you! :)

I think I did it right. Let me know if it can be worked on.

A side note, I had issues with the inner loop because I forgot it must iterate through until the condition is false. lol

      // variables to work with
      let jsonObject = JSON.parse(catString);  
      let motherInfo ="";
      let numberOfKittens = 0;
      let kittenMaleCount = 0;
      let kittenFemaleCount = 0;
      let kittenInfo = "";
      
      for(let i = 0; i < jsonObject.length; i++){
            if(i == jsonObject.length - 1){
                motherInfo += "and "+jsonObject[i]["name"] +".";
            }else{
                motherInfo += jsonObject[i]["name"] +", ";
             }
            
            for(let j = 0; j < jsonObject[i]["kittens"].length; j++){
                if ( jsonObject[i]["kittens"][j]["gender"] === "m" ){
                    kittenMaleCount++;
                }else if( jsonObject[i]["kittens"][j]["gender"] === "f"){
                    kittenFemaleCount++;
                }
            }
            numberOfKittens += jsonObject[i]["kittens"].length;       
      }

    kittenInfo = `
    The number of mother kittens is = ${numberOfKittens}
    The number of male kittens = ${kittenMaleCount}
    The number of female kittens = ${kittenFemaleCount}`;