I have a variable var a = '204444'
, and I want to remove . I need the result to be
204444
.
I tried using a.replace(/\/g, '')
, but the result is not what I wanted.
I have a variable var a = '204444'
, and I want to remove . I need the result to be
204444
.
I tried using a.replace(/\/g, '')
, but the result is not what I wanted.
If you have control over the variable initialisation you can do this
var a = String.raw`204444`;
a.replace(/\/g, '');
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/raw
If you don't you can do this (but that doesn't work if you have leading 0s)
var a = '2304444';
a.charCodeAt(0).toString(8) + a.replace(/^./g, '');