Although I'd have done return string.includes(x) but I like your version still.
The .every() method returns true if every element of the array meets the condition, else it returns false..
This solution is at least 5 years old, so maybe Node 6 wasn't available at that time.
This comment is hidden because it contains spoiler information about the solution
Like the solution, However I'd not try to mess with prototype of built-in objects
This is so neat I can't believe it, I took many many more lines.
Can someome explain how it works? I don't even understand how it correctly returns a boolean!
Cool that's so clever. It took me 3 times as many lines of code. I'm learning a lot by looking at the solutions of others. Thanks.
i'm not sure modifying the built-in function is recommended.
Reraised as an issue.
return "No" , for all falsy values in js i.e. for ex. null, undefined , "" , 0 etc.
throw Error, who didnt come up
('reject again should give an error')What error you want?
I agree with you.
I think this is semi wrong answer!
This was my first solution...
then I realized that I will return 'No' in multiple false negative cases, like '', null, undefined, 'or anything that is not True'.
This is not right