Well… I guess I better ask for some help on this one:
const name = “alain”;
const arr = ["alain@gmx.net", "james@gmx.net", "helen@gmx.net", "smith@gmx.net"];
All I wanna do is this: Search for the email-address starting with “alain” and return that email-address to me as a variable that I can use in other functions.
Any idea how this could be achieved?
Thanks:)
>Solution :
const address = arr.find(element => element.startsWith(name))