For example I have code like this:
var myArr="14:44:45".split(":");
But sometimes time value doesn't have "seconds" information.
var myArr="14:44".split(":");
Basicly sometimes the string has value of "seconds" and sometimes has not.So how can I check if the myArr[2]
has value.What is the best practice for that?
if(myArr.length === 3)
Is it okay?
Edit: or
if(myArr[2])
myArr
array.