DEV Community

loading...

Discussion on: Spread Syntax "Three-dots" Tricks You Can Use Now

Collapse
girlie_mac profile image
Tomomi Imura 🐱 Author

Another example I thought about (well, this is the variant of the "string to array") -

const isAnagram = (str1, str2) => {
  return [...str1].sort().join() === [...str2].sort().join();
};

isAnagram("deno", "node"); // true