A solution I prefer would be:
const str = 'sometext-20202';const slug = str.split('-').pop();
Where slug
would be your result
A solution I prefer would be:
const str = 'sometext-20202';const slug = str.split('-').pop();
Where slug
would be your result