Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

check if the last character of word is "A"

function lastWord(lastWord) {

    var hello = lastWord;
var lastCharOfHello=hello.slice(-1);

if (lastCharOfHello === "a")
{
return lastCharOfHello;
}
else {
   return "Not A sorry loser";
}
}
console.log(lastWord("Ray"));
 
PREVIOUS NEXT
Tagged: #check #character #word
ADD COMMENT
Topic
Name
6+8 =