Hi coders,
I’m looking different solutions that there were for the challenge "21 Days of Coding Challenge " from LighthouseLabs and I came across this arrow function:
I have some doubts about the second “argument” of function , neighbourhoods = ["one"],
I don’t understand why “one” was used and the array passed in the function was not declared without values or other values.
I put the link to where I found this solution : https://github.com/joranquinten/lighthouse-21-days-of-code/blob/master/assignment-01.md
Thanks, CamCode
Uhm, i think is a quite obvious typo, you can signal it (the non-empty array should be the volunteer’s one)^^
Mh, i guess the reasoning behind the formula used is that none of the volunteers has to go through an entire neighborhood (1), each volunteer would be assigned to 0.83 part of it
But, to answer the question probably would be much appropriate to use Math.ceil, because you will visit at least one neighborhood (it doesn’t matter if you go through all the houses) and in case you would be assigned to a 1.01 neighborhood you would still have to visit 2^^
If you have 5 neighborhoods and 6 volunteers answer should be 0.83 as that’s how much neighborhoods they will visit in average. I don’t quite get, why would you use Math.floor() or Math.ceil() for that
And the problem might be a little less ambiguous if it either specifies ‘in average’ or asks for the output in a form of entries with number of jobs next to volunteer