I'm a new student struggling with an exercise that requires writing multiple functions. The goal is to create a function that prompts the user for their first and last name, separates the names using a space, and then outputs specific initials in different cases. The task involves writing three functions: one to display the first letter of the first name in its original case, another for the first letter of the last name also in original case, and a third function to output both initials in uppercase. I've managed to complete the first function successfully, but I'm stuck on understanding how to use the split function to achieve the other two requirements. Here's what I have so far:
function GetText(promptMessage){
let x = prompt(promptMessage);
return x;
}
function Initials(FirstName, LastName){
text = Firstname.charAt(0);
return text;
}
text =GetText("Enter your name here");
let Firstname = text;
console.log(Initials(text));
function LastInitial(FirstName, LastName){
var names = string.split(' ');
return names;
}
var names;
var LastName = LastInitial(LastName);
console.log(LastName);
I've been trying different approaches to write the second function without success, and I haven't even begun working on the Uppercase function. Any help would be greatly appreciated. Thank you!