Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I agree. Maybe it interpreted it as return the numbers that are more than 10 in the given array of even numbers.

For example, if the instruction says "return person objects that are at least 20 years old", it might be more reasonable to generate:

array.filter(item => item.age >= 20)

as oppose to

array.filter(item => (item instanceof Person) && (item.age >= 20))



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: