How to remove the last character from a string in Node.js

1 Answer

0 votes
let s = "abcdfg*";

s = s.slice(0, -1);

console.log(s);

 
 
/*
run:
 
abcdfg
 
*/


 



answered Sep 6, 2024 by avibootz
edited Sep 6, 2024 by avibootz
...