Last active
April 19, 2023 08:16
-
-
Save Eatkin/c974e6f25c52d222e7d1a81c9b1cfe00 to your computer and use it in GitHub Desktop.
A horribly inefficient implementation of "hello world!".
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const greet = function() { | |
let greeting = ""; | |
while (greeting !== "hello world!") { | |
greeting = "h".repeat(Math.ceil(Math.random() * 5)); | |
greeting += "e".repeat(Math.ceil(Math.random() * 5)); | |
greeting += "l".repeat(Math.ceil(Math.random() * 5)); | |
greeting += "o".repeat(Math.ceil(Math.random() * 5)); | |
greeting += " ".repeat(Math.ceil(Math.random() * 5)); | |
greeting += "w".repeat(Math.ceil(Math.random() * 5)); | |
greeting += "o".repeat(Math.ceil(Math.random() * 5)); | |
greeting += "r".repeat(Math.ceil(Math.random() * 5)); | |
greeting += "l".repeat(Math.ceil(Math.random() * 5)); | |
greeting += "d".repeat(Math.ceil(Math.random() * 5)); | |
greeting += "!".repeat(Math.ceil(Math.random() * 5)); | |
} | |
return greeting; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment