added brute force, reminder, this is js, no tail call optimizations