Skip to content

Instantly share code, notes, and snippets.

@samchouse
Created June 23, 2023 17:51
Show Gist options
  • Select an option

  • Save samchouse/e1ab321154af1183607ccfb7992f8703 to your computer and use it in GitHub Desktop.

Select an option

Save samchouse/e1ab321154af1183607ccfb7992f8703 to your computer and use it in GitHub Desktop.
const scramble = (content: string) => {
return content.split(" ").map((word) =>
word.slice(0, 1) +
word.slice(1, word.length - 1).split("").sort(() => Math.random() - 0.5)
.join("") +
word.slice(word.length - 1)
).join(" ");
};
console.log(scramble(Deno.args[0] ?? ""));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment