Created
December 26, 2018 02:22
-
-
Save black-black-cat/3a6a08f228a135be3630bdd04307e8cb to your computer and use it in GitHub Desktop.
generate verification code
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>GistRun</title> | |
<link rel="stylesheet" href="styles.css"> | |
</head> | |
<body> | |
<h1>Hello world!</h1> | |
<script src="script.js"></script> | |
</body> | |
</html> |
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
function getCode (size = 6, part = '') { | |
let str = '' + Math.random() | |
str = str.replace(/^0\.?/, '') | |
part = part + str | |
return part.length < size | |
? getCode(size, part) | |
: part.slice(0, size) | |
} | |
for (let i = 0; i < 10; i++) { | |
console.log(getCode()) | |
} |
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
/* todo: add styles */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment