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:
How to convert html to pdf in Node js12-03-2017 pdf convert html node js |
Navigate to another page using java script06-03-2017 javascript redirection navigation |
Change datepicker display format06-03-2017 datepicker angular js |
How to find Angular Errors06-03-2017 errors angularjs exceptionHandler |
Filters for convert text to camel case in Angular Js05-03-2017 angularjs camelcase filters |