I'm learning JS and I would greatly appreciate your help. I would like to us higher order functions and callbacks if possible.
Task
- Declare these local variables and make them equal to the appropriate information, firstName, LastName, linkedIn, phone, city.
- Using string concatenation, make a local variable fullName equal to your first and last names separated by a space.
- Make a local variable linkedIn, a string which is a link to your LinkedIn profile.
- Make a local variable info which is an array containing your fullName, linkedIn, phone, and city variables, in that order.
- Make a local variable education which is an array containing the name of your college/university, field of study, an integer which is your year of (anticipated) graduation. Make sure it's in that order.
- Define a function createApp which takes your info and education as arguments in that order. This should return an object containing 2 keys. The key names must be the same as your variable names. Set the values of these keys to the corresponding arguments.
Steps 1-5: Created local variables.
(function person() {
var firstName = "Rob",
lastName = "Johnson",
fullName = firstName + ", " + lastName,
linkedIn = 'https://www.linkedin.com/in/robjohnson',
phone = 3105559288,
city = 'Los Angeles',
info = [firstName, linkedIn, phone, city],
education = ['UWRock','Generals','2017'];
})();
step 6. return an object containing 2 keys. The key names must be the same as your variable names. Set the values of these keys to the corresponding arguments. I have no idea, I assume this should be dynamic not hard coded.
function createApp(info, education){
var myObj = {};
return(myObj);
};
I think I'm suppose to return something like this using a callback:
myObj {
info:'Rob',
education: ['UWRock','Generals','2017']
};