Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* create a function named "scramble" that takes a string argument, shuffles its characters around and returns the result. */
- function scramble(str: string): string {
- let result = "";
- for (let i = 0; i < str.length; i++) {
- result += str.charAt(Math.floor(Math.random() * str.length));
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment