Write Higher Order Arrow Function thoughts

Write Higher Order Arrow Function thoughts
0

#1

I think this challenge might be way to hard for some beginners, and I am going to be honest, the only reason I solved this challenge relatively easy was because I knew about filter and map method, otherwise I’m afraid I wouldn’t be able to solve this challenge .

The funny thing is that after I solved the challenge I checked the solution to see if they used another approach using some of the concepts taught in previous lessons, turns out the solution also used filter and map.

My question is, how can someone who has never used or seen theses methods before come up with that solution? In my honest opinion I think it’d be better if they talk about filter, map and reduce before presenting this challenge.

Thoughts?

edit: btw, what’s the easiest way to know if a number is an integer other than using Number.isInteger() method.


#2
// if you want to check if num is an integer
if (num === parseInt(num) {

OR

if (num % parseInt(num) === 0) {

OR

if (!(num % parseInt(num))) {

#3

I thought the parseInt method only works with string but I after seeing your example I read the documentation and it also works with numbers. These are very clean solutions, thanks again.


#4

Do they look easier than simply calling Number.isInteger()?


#5

No, in fact it’s the other way around. But I just wanted to know, you know, out of curiosity.


#6

FYI - Number.isInteger is not supported on any version of Internet Explorer, so you would need to make your own isInteger function or use a Polyfill if your site will need to support that browser.