JavaScript Eliminar el último carácter de la cadena
var str = 'mystring';
// the character 'g' will be removed
str = str.slice(0, -1);
Coding Random Things
var str = 'mystring';
// the character 'g' will be removed
str = str.slice(0, -1);
let str = "Hello Worlds";
str = str.slice(0, -1);
const text = 'abcdef'
const editedText = text.slice(0, -1) //'abcde'
var str = "Hello";
var newString = str.substring(0, str.length - 1); //newString = Hell
var str = "Hello TecAdmin!";
var newStr = str.slice(0, -1);
let str = "12345.00";
str = str.substring(0, str.length - 1);
str = str.substring(0, str.length - 1);
let str = "meguenniwalid";
//will remove d from str by using slice()
str = str.slice(0, -1);
//output
console.log(str);
//meguenniwali
let str = "12345.00";
str = str.substring(0, str.length - 1);
console.log(str);
Run code snippetHide results
str - roblox(100, -1);