I want to get the first name of a customer and use that in other functions.
I have an address:
John Doe Streetname 1 1234AA Village
function firstName(){
let address = "John Doe\nStreetname 1\n 1234AA Village";
let firstname = adres.split(' ')[0];
}
function customerText(){
firstName();
let text = "Dear "+firstname+", how is life?";
alert(text);
}
So that the result would be: Dear John, how is life?
But unfortunately, it doesn't. Don't know how this should work?