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
Get step-by-step solutions from verified subject matter experts
