Is there another a way to开发者_Go百科 concatenate a '#' character like I'm doing below?
radioButtonID = '#' + radioButtonID;
"#".concat(radioButtonID)
or
["#",radioButtonID].join('')
I suppose you could do something like this:
var radioButtonID = ['#', radioButtonID].join('');
That's about as short as it could get if you are prefixing.
What's wrong with what you've got there? That should work.
Unless you're looking for a stringbuffer or something...
Not very efficient, but this works:
radioButtonID.replace(/(.+)/,"#$1")
精彩评论