I have a variable that returns a nested object,
console.log (moviesTrailer)
Returns,
[Object]
0: Object
backdrop: "/LvmmDZxkTDqp0DX7mUo621ahdX.jpg"
cast: null
created_at: "2016-01-08T17:21:32.112Z"
crew: null
id: 35
image: "/bIuOWTtyFPjsFDevqvF3QrD1aun.jpg"
movie_id: "10195"
release_date: "2011-04-28"
title: "Thor"
updated_at: "2016-01-08T17:21:32.112Z"
user_id: null
__proto__: Objectlength: 1
__proto__: Array[0]
How can I reach data such as id, or title?
I've tried
console.log (moviesTrailer.object[0].id)
and
console.log (moviesTrailer.data[0].id)
but this returns a TypeError: Cannot read property '0' of undefined.
[Object]. You have to reference the index firstmoviesTraileris an object with a property called0, instead of an array with index0.