Iterating Over Nested Object in NodeJS

How do I iterate over a dynamic nested object

  "2021-02-01": {
    "INR": 88.345,
    "CZK": 25.975,
    "JPY": 126.77
  "2021-02-02": {
    "INR": 87.906,
    "CZK": 25.9,
    "JPY": 126.46
  "2021-02-05": {
    "INR": 87.367,
    "CZK": 25.806,
    "JPY": 126.72

Note: currency is dynamic it can change to other currency like here it is "INR, CZK, JPY" it can change to "USD, EUR, INR"

I need to get the value of all exchange rate of all currency in object and sum up all of them

here is what i have code (it is incomplete and i’m stuck in it)

      let rates = {here is object mentioned above}
      //iterating over object and pushing into array rateList
      for(let keys in rates){
      //iterating over rateList array to get value
          console.log(Object.keys(obj)) //by this code i'm getting keys but how do i get value and sum it up

Overall the objective is to get the value of all exchange rate value and sum it up

132 thoughts on “Iterating Over Nested Object in NodeJS”

  1. Hey I am so thrilled I found your site, I really found you by mistake,
    while I was looking on Yahoo for something else, Anyhow I am here now
    and would just like to say kudos for a remarkable post
    and a all round thrilling blog (I also love the
    theme/design), I don’t have time to read it all at the minute but I have book-marked it
    and also included your RSS feeds, so when I have time I will be back to read more, Please do keep up the great work.

  2. My developer is trying to persuade me to move to .net from PHP.
    I have always disliked the idea because of the costs.
    But he’s tryiong none the less. I’ve been using WordPress on a variety of websites for about a year and
    am anxious about switching to another platform. I have heard great things about

    Is there a way I can transfer all my wordpress posts into it?
    Any kind of help would be really appreciated!


Leave a Comment