How to remove whitespace from both start and ends of a string in Node.js

1 Answer

0 votes
let s = "          node.js Java C C++ PHP          ";
 
s = s.trim()
 
console.log(s);


 
/*
run:
 
node.js Java C C++ PHP
 
*/

 



answered Nov 21, 2024 by avibootz
...