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

1 Answer

0 votes
let s = "node.js programming";
 
const N = 4;
s = s.slice(0, -N); 
 
console.log(s);
  
    
 
   
/*
run:
       
node.js program
    
*/

 



answered Sep 12, 2024 by avibootz

Related questions

...