Skip to content

Instantly share code, notes, and snippets.

@mturnwall
Created July 23, 2018 21:46
Show Gist options
  • Save mturnwall/1e4ccd58fb146203e64419ce4adee636 to your computer and use it in GitHub Desktop.
Save mturnwall/1e4ccd58fb146203e64419ce4adee636 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/cofiyeh
<!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>
'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