The below function return a random string with given length
function randomString(length) { chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; var result = ''; for (var i = length; i > 0; --i) result += chars[Math.round(Math.random() * (chars.length - 1))]; return result; } var res = randomString(4); alert(res);
You might also like:
Convert and download html to pdf without saving file28-10-2018 node js convert html to pdf pdf download pdf without saving |
How to use http-post request in node js14-03-2017 http-post module node js |
Filter for change Date format (MM-dd-yyyy) in Angular Js05-03-2017 mm-dd-yyyy date formats angular js |
How to set or update or push the values into Object in javacript27-02-2017 javascript set update push object |
Send Mail in Node Js21-02-2017 node js mail npm module |