What does this expression return?
'2024-06-15'.match(/^(\d{4})-(\d{2})-(\d{2})$/).slice(1)
- ['2024', '06', '15']
- ['2024-06-15']
- ['06', '15']
- ['2024-06-15', '2024']
Element 0 is the full match, so
Play Regex ▸
slice(1) keeps just the three captured date parts.