Requesting data from the mapbox API I can print the whole JSON object to the console but when I try and print some of the "sub objects" I get "Uncaught TypeError: Cannot read property 'x' of undefined" error.
In Chrome dev tools I can print out the sub object fine.
var suggestedLocationsReturn = $.get("https://api.mapbox.com/geocoding/v5/mapbox.places/Los%20Angeles.json?access_token=MY_API_KEY", 'json');
This prints the object fine
console.log(suggestedLocationsReturn);
This throws the error
console.log(suggestedLocationsReturn.responseJSON.features[0].place_name);
But running the above line in the Chrome dev tools console displays the data as expected.