How do I iterate an array in an array?

How do I iterate an array in an array?

Some on the objects in my array have a nested array. I'm having trouble getting the values these arrays.

This is an example from the array:
  1. {
    "item": [
    {
    "title": "Sat, 01 Dec",
    "pubDate": "Sat, 01 Dec 2018 00:00:00 GMT",
        "episodes": {
            "episode": {
                "show": "The Gadget Show",
                "name": "Episode 9",
                "format": "s28e09",
                "summary": ""
         }
     }      
    },
    {
    "title": "Wed, 28 Nov",
     "description": ""
    "pubDate": "Wed, 28 Nov 2018 00:00:00 GMT",
        "episodes": {
            "episode": [
                 {
                "show": "Adam Ruins Everything",
                "name": "Adam Ruins Guns",
                "format": "s03e01",
                "summary": "",
                },
                {
                "show": "Adam Ruins Everything",
                "name": "Adam Ruins Guns",
                "format": "s02e23",
                "summary": "",
                }
               },
    {
    "title": "Tue, 27 Nov",
    "description": "",
    "pubDate": "Tue, 27 Nov 2018 00:00:00 GMT",
        "episodes": {
            "episode": [
                {
                "show": "The Great Christmas Light Fight",
                "name": "Episode 1",
                "format": "s06e01",
                "summary": "",
                },
     {
                "show": "The Great Christmas Light Fight",
                "name": "Episode 2",
                "format": "s06e02",
                "summary": ""}
                ]
                 }
            }
  2. ]
  3. }


This is the code I'm trying to get to work:
  1. <html>
    <head>
    <script src="https://code.jquery.com/jquery-3.1.1.js"></script>
    <script src="http://yui.yahooapis.com/3.18.1/build/yui/yui-min.js"></script>
    </head>
    <body>

    <script>
        $(document).ready(function(){
    YUI().use('yql', function(Y){
        var query = 'select * from rss where url = "https://episodecalendar.com/en/rss_feed/9da99081-ef1e-11e8-8f02-901b0ecd79cd"'
       
        var q = Y.YQL(query, function(r){
           console.log(r);
     
            $.each(r.query.results.item, function(index, item) {
                var rssTvTitle = (item.episodes.episode.show);
                console.log('1 '+rssTvTitle);       
           
                if (typeof this.episodes.episode.show === 'undefined') {
                        for (i = 0; i < this.episodes.episode.length; i++) {
                rssTvTitle = (item.episodes.episode[i].show);
                console.log('2 '+rssTvTitle);               
                };                   
            };

        $('#weekWrap').append('\n<div class="upcomingShows">'+rssTvTitle+'</div>\n');
                    });         
                });
             });
        });
    </script>

    <div id="weekWrap"></div>
    </body>
    </html>

The items that don't have a child array work fine, but the items that do have nested arrays, I can only get the first value.

Thank you for any help.