I have a string in JavaScript like #box2 and I just want the 2 from it.
I tried:
var thestring = $(this).attr('href');
var thenum = thestring.replace( /(^.+)(\w\d+\w)(.+$)/i,'$2');
alert(thenum);
It still returns #box2 in the …
What's the "best" way to convert a number to a string (in terms of speed advantage, clarity advantage, memory advantage, etc) ?
Some examples:
String(n)
n.toString()
""+n
n+""
Is there any function in Javascript for formatting number and strings ?
I am looking for a way for thousand separator for string or numbers...
(Like String.Format In c#)