mdn trimstart 1

mdn trimstart

const greeting = '   Hello world!   ';
console.log(greeting);
// expected output: "   Hello world!   ";
console.log(greeting.trimStart());
// expected output: "Hello world!   ";

Here is what the above code is Doing:
1. The first console.log() statement logs the original string.
2. The second console.log() statement logs the string with the whitespace removed from the beginning.

Similar Posts