String split and get first and last occurrences

Viewed 44578

I have a long string of ISO dates:

var str = "'2012-11-10T00:00:00.000Z', '2012-11-11T00:00:00.000Z', ****  '2013-11-12T00:00:00.000Z'";

I need to get the first and last dates only. I could do

var vStr = str.split(',');
vStr[0] and vStr[vStr.length - 1]

But it's a waste memory, because I only need the first and last occurrences. Ideas? Thanks.

4 Answers
Related