Search Results

Search found 2 results on 1 pages for 'yoavf'.

Page 1/1 | 1 

  • JavaScript: add or subtract from number in string

    - by yoavf
    I have a string that looks like "(3) New stuff" where 3 can be any number. I would like to add or subtract to this number. I figured out the following way: var thenumber = string.match((/\d+/)); thenumber++; string = string.replace(/\(\d+\)/ ,'('+ thenumber +')'); Is there a more elegant way to do it?

    Read the article

1