Skip to main content
edited body
Source Link

Use String.prototype.replace() to change the space for an empty space.

const str = "B72 1JL";

// Replacing " " (space) to "" empty space
const res = str.replace("/ "/g, ""'');
console.log(res); // BJ721JL

Use String.prototype.replace() to change the space for an empty space.

const str = "B72 1JL";

// Replacing " " (space) to "" empty space
const res = str.replace(" ", "");
console.log(res); // BJ721JL

Use String.prototype.replace() to change the space for an empty space.

const str = "B72 1JL";

// Replacing " " (space) to "" empty space
const res = str.replace(/ /g, '')
console.log(res); // BJ721JL
Source Link

Use String.prototype.replace() to change the space for an empty space.

const str = "B72 1JL";

// Replacing " " (space) to "" empty space
const res = str.replace(" ", "");
console.log(res); // BJ721JL