Skip to content

Instantly share code, notes, and snippets.

@belocer
Created September 25, 2020 09:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save belocer/abca7f3e235f525746b8fe765cd39b77 to your computer and use it in GitHub Desktop.
Save belocer/abca7f3e235f525746b8fe765cd39b77 to your computer and use it in GitHub Desktop.
Деструктуризация && минимальное и максимальное число в массиве
const destr_arr = [1, 2, 3, 4, 5, 6, 7, 18]
const [a, b] = destr_arr
const [c, d, ...e] = destr_arr
const [f, g = 42, ...k] = destr_arr
console.log(a, b, c, d, e, f, g, k)
const arr = [1, 2, 3, 4, 5, 6, 7, 8]
console.log(Math.max(...arr)) // 8
console.log(Math.min(...arr)) // 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment