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
  • "overly complex": yes! What's the point of taking the question which asks about parsing one string and giving an answer that formats a list of them? Commented Feb 18, 2018 at 22:10
  • "So how can I check if the myArr[2] has value." So the objective is not this or this?: Check array elements has value Commented Feb 18, 2018 at 22:35
  • The OP wanted to check that the array resulting from timeStr.split(':') had a third element, representing seconds. Commented Feb 18, 2018 at 22:41
  • "The OP wanted to check that the array resulting from timeStr.split(':') had a third element, representing seconds." Yeah, see example 2 and 3. "What's the point of taking the question which asks about parsing one string and giving an answer that formats a list of them? " Because of the fact OP says sometimes the timestamp is like 11:11:11 and sometimes timestamp is like 11:11. That pattern along with the fact the object is a timestamp infers that there's a possibility that he could have an array. Besides Example 1 covers for a condition when one timestamp exists instead of array. Commented Mar 30, 2018 at 23:11