开发者

How to get Match to return an INT and not an array

I have the following:

    var hashID = location.hash.match(/\d/);

Where location.hash eqs: #/groups/58

I want hashID to equal = 58

Right now it equals an array. How can I get back j开发者_如何转开发ust 58 as an int? THanks


  var hashID = parseInt(location.hash.match(/\d+/)[0])
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜