/* 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;
}
Comments