gempir

Untitled

Sep 5th, 2021
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. /* create a function named "scramble" that takes a string argument, shuffles its characters around and returns the result. */
  2. function scramble(str: string): string {
  3. let result = "";
  4. for (let i = 0; i < str.length; i++) {
  5. result += str.charAt(Math.floor(Math.random() * str.length));
  6. }
  7. return result;
  8. }
Advertisement
Add Comment
Please, Sign In to add comment