javascript get last character of string
var str = "Hello";
var newString = str.substring(0, str.length - 1); //newString = Hell
javascript get last character of string
var str = "Hello";
var newString = str.substring(0, str.length - 1); //newString = Hell
find the length and the last character of string in js
// Get The Length Of The String.
function strLength(x){
var counter = 0;
while(x[counter] !== undefined){
counter++;
}
return counter;
}
var str = prompt("Write your string ...",''); // Get String From User.
var The_Length = strLength(str); //
var lastChar = counter - 1; // The Index Of Last Letter.
console.log(`The Length Of Your String is ${counter}`);
console.log(`The Last Char In Your String Is ${str[lastChar]}`);
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us