0

Maybe a silly question, I am trying to extract the values of an object, for some reason I get errors. In the below picture I am trying to get the value of sumchans__totalUnits__c. The value below is stored in the variable penStatDates. This is what I tried:

console.log(penStatDates[0]); Gives me the below data.
console.log(penStatDates[0].sumchans__totalUnits__c);-this gives me errors.

Also trying to extract the values of the inner array. Please advise!

enter image description here

enter image description here

put on hold as off-topic by glls, Reshma, Pranay Jaiswal, Martin Lezer, codeyinthecloud Jan 14 at 15:29

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on problems in code you've written must describe the specific problem and include valid code to reproduce it. For help writing short, self-contained syntactically-valid examples, see: SSCCE.org" – glls, Reshma, Pranay Jaiswal, Martin Lezer, codeyinthecloud
If this question can be reworded to fit the rules in the help center, please edit the question.

  • That error does not make a ton of sense. It basically means penStatDates[0] is undefined. Seems like you must be making a mistake somewhere copying your code or errors into this post. You really have those console logs side by side? – Adrian Larson Jan 11 at 22:58
  • Hey Adrian, I do see that my above code works now. The saving process when developing on developer console sometimes takes a long time, so I was not seeing updates at all. – Sumchans Jan 11 at 23:11