Skip to content

Instantly share code, notes, and snippets.

@zlrlo
Last active November 15, 2022 09:54
Show Gist options
  • Select an option

  • Save zlrlo/68b6f4c82bd46385f540f6d21bbcf1c6 to your computer and use it in GitHub Desktop.

Select an option

Save zlrlo/68b6f4c82bd46385f540f6d21bbcf1c6 to your computer and use it in GitHub Desktop.
javascript trick - 함수형 프로그래밍 방식 범위 루프
// for (let i = 5; i < 10; i += 1) { sum += i }
const sum = Array.from(new Array(5), (_, i) => i + 5).reduce((acc, cur) => acc + cur, 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment