// String Array
let strArray = [activitiesOfDailyLiving, socialRecreational, travel, interpersonalRelationships, concentrationPersistencePace,resilienceEmployability];
// convert strings to numbers in a separate array
let numArray = strArray.map(n => Number(n));
- “=>” Arrow functions allow us to write shorter function syntax.
- “Number(n)” Number(value) converts a string or other value to the Number type.
- “strArray.map” The map() method creates a new array populated with the results of calling a provided function on every element in the calling array.
From what I understand, the following happens:
-
Take a string strArray and map it thereby applying a functioning to each value in the string array.
-
“n” is the name of a new function, which converts each passed on value to a number. The value is fed from step 1 strArray.map.