Created
July 23, 2018 21:46
-
-
Save mturnwall/1e4ccd58fb146203e64419ce4adee636 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/cofiyeh
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> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
'use strict'; | |
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } } | |
var generateGuid = function generateGuid(length) { | |
return [].concat(_toConsumableArray(Array(length))).map(function () { | |
return Math.random().toString(32).substring(2); | |
}).join(''); | |
}; | |
console.log(generateGuid(1)); | |
console.log(generateGuid(2)); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">const generateGuid = (length) => { | |
return [...Array(length)].map(() => { | |
return Math.random().toString(32).substring(2); | |
}).join(''); | |
}; | |
console.log(generateGuid(1)); | |
console.log(generateGuid(2));</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
'use strict'; | |
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } } | |
var generateGuid = function generateGuid(length) { | |
return [].concat(_toConsumableArray(Array(length))).map(function () { | |
return Math.random().toString(32).substring(2); | |
}).join(''); | |
}; | |
console.log(generateGuid(1)); | |
console.log(generateGuid(2)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment