Question: Test the map function in Example F from Lab1Template.html . Try modifying it to make sure that you understand it. a) Using map , write

Test the map function in Example F from Lab1Template.html . Try modifying it to make sure that you understand it.

a) Using map , write code that when given an array of strings, returns the length of each string. ie: [Canada, Mauritania, US, Iceland ]. map(function() { ..... }) returns [6, 10, 2, 7]

//Example F: map: apply a function to each item in a list list=[1,2,3,4,5,6]; result=list.map(function (x) { return x*x;}); console.info("Example F: map"); console.log(result);

using javascript

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!