I am learning JS and I would really appreciate your help. I would like to get higher functions and callbacks if possible.
Task
- Declare these local variables and make them equal to the corresponding information, firstName, LastName, linkedIn, phone, city .
- Using string concatenation, create a local variable fullName equal to your first and last names, separated by a space.
- Create a local variable linkedIn , which is a link to your LinkedIn profile.
- Create a local info variable, which is an array containing your fullName , linkedIn , phone and city , in that order.
- Create a local variable education , which is an array containing the name of your college / university, area of ββstudy, an integer that is your year (expected). Make sure in that order.
- Define a createApp function that takes your information and education as arguments in that order. This should return an object containing 2 keys. Key names must match variable names. Set the values ββof these keys to the corresponding arguments.
Steps 1-5: Local variables created.
(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. Key names must match variable names. Set the values ββof these keys to the corresponding arguments. I have no idea, I suppose this should be dynamic, not rigid.
function createApp(info, education){ var myObj = {}; return(myObj); };
I think I should return something like this with a callback:
myObj { info:'Rob', education: ['UWRock','Generals','2017'] };
source share