Given three variables firstName, middleName, lastName, write the code to put all the three variables in an array and return the array
let firstName = "John";
let middleName = "P";
let lastName = "Smith";
function getFullName(firstName, middleName, lastName){
// write code here
}
getFullName(firstName,middleName,lastName);// should return ["John","P","Smith"]
Given an array containing the firstName, middleName and lastName , write a function that returns a string with the three names separated by '-'
let nameArray=["John","P","Smith"];
function printFullName(nameArray){
// write your code here
}
printFullName(nameArray);// should return "Jon-P-Smith"