Answers for "how to get the last characters on string js"

12

get last three characters of string javascript

var member = "my name is Afia";

var last3 = member.slice(-3);

alert(last3); // "fia"
Posted by: Guest on June-28-2021
0

how to get lastchar in string in js

//Gettimg the last character of an unknown string;
//using function Expression;
const gettingLastChar = function(userInput){
     return userInput.substring(userInput.length -1);
  //for Debugging;
  let letsDebug = `${userInput.substring(userInput.length -1)}`;
  console.log(letsDebug);
}
Posted by: Guest on April-20-2022

Code answers related to "how to get the last characters on string js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language