JSFiddle - React, Tailwind, and code Playground
JavaScript
var pList = ["Tina V", "Luke B", "Joe T", "Gregor A", "Adria B", "Brad F"];
function addPassenger() {
var pName = prompt("Please type in the name of the new passenger.");
if (typeof pName != "string") {
alert("I'm sorry but that is an invalid passenger name.");
return false;
} else {
pList.push(pName);
alert(pName + " has been added to the passenger list.");
return pList;
}
}
var logThis = addPassenger();
console.log(logThis);