Get everything after the dash in a string in JavaScript

What would be the cleanest way of doing this that would work in both IE and Firefox?

My string looks like this sometext-20202

Now the sometext and the integer after the dash can be of varying length.

Should I just use substring and index of or are there other ways?

131 thoughts on “Get everything after the dash in a string in JavaScript”

  1. I’m not sure where you are getting your info, but good topic.
    I needs to spend some time learning much more or understanding more.
    Thanks for excellent info I was looking for this info for my
    mission.

    Reply
  2. Hi terrific website! Does running a blog similar to this take
    a large amount of work? I’ve virtually no knowledge of coding but I was hoping to start
    my own blog in the near future. Anyway, should you have
    any suggestions or tips for new blog owners please
    share. I know this is off subject nevertheless I simply needed to ask.

    Thanks!

    Reply
  3. Its like you learn my mind! You appear to know so much about this, like you wrote the ebook in it or something.
    I think that you simply can do with some % to drive the
    message house a little bit, however instead of that,
    that is fantastic blog. A fantastic read. I will
    definitely be back.

    Reply
  4. Hello! I could have sworn I’ve been to this blog before but after browsing through some of the
    post I realized it’s new to me. Nonetheless, I’m definitely delighted I found it and I’ll be book-marking and checking back often!

    Reply
  5. Your style is really unique in comparison to other people I’ve read stuff from.
    I appreciate you for posting when you have the opportunity,
    Guess I will just book mark this site.

    Reply
  6. This design is steller! You obviously know how to keep a reader amused.
    Between your wit and your videos, I was almost moved to start my own blog (well,
    almost…HaHa!) Excellent job. I really enjoyed what you had to say,
    and more than that, how you presented it.

    Too cool! cheap flights http://1704milesapart.tumblr.com/ cheap flights

    Reply
  7. I blog frequently and I seriously thank you for your content.

    The article has truly peaked my interest. I
    am going to bookmark your site and keep checking for new details about once
    a week. I opted in for your Feed too.

    Reply
  8. Pingback: aralen eye
  9. Pingback: latisse online
  10. Pingback: clomid 100 mg
  11. Pingback: 8 mg tizanidine
  12. naturally like your web-site but you need to test the spelling on quite
    a few of your posts. A number of them are rife with spelling issues and I find it
    very bothersome to inform the reality however I will certainly come back again.

    Reply
  13. Hi! This is kind of off topic but I need some advice from an established blog.
    Is it very difficult to set up your own blog? I’m not very techincal but I can figure things out pretty quick.
    I’m thinking about making my own but I’m not sure where to start.
    Do you have any tips or suggestions? With thanks

    Reply
  14. I have read a few good stuff here. Certainly price bookmarking
    for revisiting. I wonder how a lot attempt you place
    to make this kind of magnificent informative website.

    Reply
  15. hello there and thank you for your information – I’ve definitely picked up anything
    new from right here. I did however expertise some
    technical points using this site, as I experienced to reload the site many times previous to I could get it to load
    correctly. I had been wondering if your web hosting is OK?
    Not that I am complaining, but sluggish loading instances times will very frequently affect your placement in google and can damage your high quality score if ads and marketing
    with Adwords. Well I’m adding this RSS to my e-mail and
    could look out for much more of your respective intriguing content.
    Make sure you update this again very soon.

    Reply
  16. Its such as you learn my thoughts! You seem to know so much approximately this,
    such as you wrote the e book in it or something. I think that you could do with a few percent to drive the message home a bit, but
    instead of that, that is fantastic blog. An excellent read.
    I’ll certainly be back.

    Reply
  17. Hi there! I could have sworn I’ve visited this blog before but after
    browsing through some of the articles I realized it’s
    new to me. Regardless, I’m definitely delighted
    I found it and I’ll be book-marking it and checking back regularly!

    Reply
  18. I’ve been exploring for a bit for any high quality articles or blog posts in this
    sort of area . Exploring in Yahoo I eventually stumbled upon this website.

    Studying this info So i am happy to express that I’ve a very excellent uncanny feeling I discovered exactly what I needed.
    I so much definitely will make certain to don?t omit this web site
    and provides it a glance on a continuing basis.

    Reply
  19. I have learn a few just right stuff here. Definitely price bookmarking for revisiting.
    I surprise how so much attempt you set to create any such wonderful informative
    web site.

    Reply
  20. Hmm it looks like your site ate my first comment (it was extremely long) so I
    guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog.
    I too am an aspiring blog blogger but I’m still new to everything.
    Do you have any tips for first-time blog writers?

    I’d certainly appreciate it.

    Reply
  21. You could certainly see your expertise in the article
    you write. The world hopes for even more
    passionate writers such as you who are not afraid to say how they believe.
    Always follow your heart.

    Reply
  22. I don’t know if it’s just me or if everybody else encountering
    problems with your blog. It appears as though some
    of the written text in your content are running off the screen.
    Can someone else please comment and let me know if this is happening to them too?
    This may be a issue with my web browser because I’ve had this happen previously.
    Many thanks

    Reply
  23. I’m now not positive the place you are getting your information, however good topic.
    I must spend a while learning much more or figuring
    out more. Thanks for great info I used to be searching
    for this info for my mission.

    Reply
  24. Hello, i think that i saw you visited my blog thus i came to “return the favor”.I am trying to find things to enhance my website!I suppose its ok to use a
    few of your ideas!!

    Reply