this is my code:
var a='(1,2,3,4)'
a=a.slice(-1,1)
alert(a)
and i print nothing.
thanks
this is my code:
var a='(1,2,3,4)'
a=a.slice(-1,1)
alert(a)
and i print nothing.
thanks
What about :
'(1,2,3,4)'.replace(/[()]/g, '')
Which will remove all ( and ) characters in the string, giving you :
"1,2,3,4"
Another alternative:
var a='(1,2,3,4)';
a.replace(/^\((.*)\)$/, "$1");