Parsing JSON in Tests but cannot read property of undefined

My question:
I am using the following to help me iterate through some JSON data

   let response = pm.response.json();
    response.forEach(function(value){
        console.info((value.name)+","+(value.id)+","+(value.schema.type))
        }
    )

The data that I am working with looks this this:

{
       "id": "statuscategorychangedate",
       "key": "statuscategorychangedate",
       "name": "Status Category Changed",
       "custom": false,
       "orderable": false,
       "navigable": true,
       "searchable": true,
       "clauseNames": [
           "statusCategoryChangedDate"
       ],
       "schema": {
           "type": "datetime",
           "system": "statuscategorychangedate"
       }
   },
   {
       "id": "issuetype",
       "key": "issuetype",
       "name": "Issue Type",
       "custom": false,
       "orderable": true,
       "navigable": true,
       "searchable": true,
       "clauseNames": [
           "issuetype",
           "type"
       ],
       "schema": {
           "type": "issuetype",
           "system": "issuetype"
       }
   },
   {
       "id": "parent",
       "key": "parent",
       "name": "Parent",
       "custom": false,
       "orderable": false,
       "navigable": true,
       "searchable": false,
       "clauseNames": [
           "parent"
       ]
   },
...

The problem is when it iterates through, I get the first 2 values as expected, but the third value throws an error because schema doesn’t exist for that entry.

Details (like screenshots):

image

In JavaScript, nearly everything is an object except for null and undefined. The error “Cannot read property of undefined” occurs when a property is read or a function is called on an undefined variable. Undefined indicates that a variable has been declared but not assigned a value. In JavaScript, properties and functions can only belong to objects. Since undefined is not an object type, calling a function or property on such a variable causes the TypeError: Cannot read property of undefined.

To prevent errors caused by variables that may not have a guaranteed value, it is recommended to verify their value for null or undefined before utilizing them. To ensure that the variables being accessed contain the expected value, there are several approaches that can be employed. One such approach is to perform if checks prior to working with objects that may undergo changes:

if (myVar !== undefined) {
    ...
}

Or

if (typeof(myVar) !== 'undefined') {
    ...
}