Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • I have noticed I have soem empty string, how would you check for null, empty string or undefined? Like this trackObj.data[c].Deaths != "" Commented Mar 24, 2020 at 14:45
  • @rob.m the technique in the answer Jack gave is probably better than mine here, where || 0 is added before each value is added to the array. Commented Mar 24, 2020 at 14:48
  • what if we have one obj like {date: "3/23/20", Confirmed: "", Deaths: "", Recovered: ""} ? Commented Mar 24, 2020 at 14:52
  • @rob.m the idea is to keep non-numeric values out of the array. That's what the || 0 code does. Now, if there are entries that have non-empty strings that are also not numbers, a different approach would be called for. Commented Mar 24, 2020 at 15:05