JavaScript or jQuery string ends with utility function

后端 未结 8 1839
遥遥无期
遥遥无期 2020-12-23 23:56

what is the easiest way to figure out if a string ends with a certain value?

8条回答
  •  鱼传尺愫
    2020-12-24 00:49

    you could use Regexps, like this:

    str.match(/value$/)
    

    which would return true if the string has 'value' at the end of it ($).

提交回复
热议问题