Note from 25 April 2022

With JavaScript, how would you compute all sorted permutations of 1 to n elements from a given array?

For example, with this source [1, 2, 3] and n=2

How would you get this?

[[1], [2], [3], [1, 2], [1, 3], [2, 3]];

  1. TIL IntersectionObserver's rootMargin only works if the observer is in the same origin, because of privacy concerns:

    There is a risk that the API may be used to probe for information about the geometry of the global viewport itself, which may be used to deduce the user’s hardware configuration.

    That's why this demo of a sticky navigation doesn't work in CodePen's default view… 😞

  2. Which (stable, lightweight, maintained, etc.) npm package would you recommend to transform any RSS or Atom feeds to a standard JSON Feed format?

  3. I needed a JavaScript way to verify if two arrays contain the same (all different) values.

    I then found a better solution for my use case, but it might be useful later, so here it is:

    const sameValues = (array1, array2) =>
    array1.length === array2.length &&
    array1.every((element) => array2.includes(element));