Quantcast
Channel: Get everything after the dash in a string in JavaScript - Stack Overflow
Viewing all articles
Browse latest Browse all 15

Answer by Jonathan for Get everything after the dash in a string in JavaScript

$
0
0

Efficient, compact and works in the general case:

s='sometext-20202's.slice(s.lastIndexOf('-')+1)

Viewing all articles
Browse latest Browse all 15

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>