0

I am trying to narrow down a selection from an object* in my console log. My code is simply:

console.log(x)

and what is being returned is as follows: result

Referencing the example image, if I wanted to call "0.filename" how would I go about navigating this returned structure.

*Apologies if object is the wrong term for what is being returned.

JDM1995
  • 5
  • 1
  • So you basically want to get a past console.log and store it in a variable? – RedGuy11 Jan 15 '21 at 04:13
  • I am trying to figure out what variable I need but I want to console.log for now. If I wanted my console to read: "image/jpeg", what would I have to call in the console.log(); I am confused on if I am looking at an array or an object... I tried (x.filesUploaded[0][3]);) but it just returned 'undefined' instead of the string – JDM1995 Jan 15 '21 at 04:20
  • For your console to say `image/jpeg`, type `console.log("image/jpeg")` – RedGuy11 Jan 15 '21 at 04:22
  • Revised my original comment, sorry for the miscommunication – JDM1995 Jan 15 '21 at 04:24
  • Oh you just wanted to know how to access the certain object value... well the answer below says how – RedGuy11 Jan 15 '21 at 04:28

1 Answers1

0

your object x have many attribute and an array filesUploaded you must use: console.log(x.filesUploaded[0].filename) because filesUploaded is an array so if you want to show all filename you must use loop for it.