Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

generate random base 64 string js

function getRandomString(length) {
    var randomChars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_';
    var result = '';
    for ( var i = 0; i < length; i++ ) {
        result += randomChars.charAt(Math.floor(Math.random() * randomChars.length));
    }
    return result;
}

var randomString = getRandomString(16); //get random alphanumberic 16 char string
Comment

js code to generate random base64 code

function getRandomString(length) {
    var randomChars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
    var result = '';
    for ( var i = 0; i < length; i++ ) {
        result += randomChars.charAt(Math.floor(Math.random() * randomChars.length));
    }
    return result;
}
var randString = getRandomString(20);//get rand alphanumberic 20 char string
var randBase64String = btoa(randString); // Base64 encode the String
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript replace multiple spaces with single space 
Javascript :: mongoose timestamps 
Javascript :: hide bootstrap modal jquery 
Javascript :: random generating api for quotes 
Javascript :: foreach nodejs 
Javascript :: javascript detect click outside element 
Javascript :: node string to json 
Javascript :: install node js windows powershell 
Javascript :: javascript convert number to string 
Javascript :: Find channel discord js 
Javascript :: field options mongoose 
Javascript :: javascript change class of item 
Javascript :: require statement not part of import statement javascript 
Javascript :: javascript button go to url 
Javascript :: remove empty or whitespace strings from array javascript 
Javascript :: checkbox click event jquery 
Javascript :: reactjs variable in string 
Javascript :: javascript play sound onclick 
Javascript :: adding integers jquery 
Javascript :: python json to excel converter 
Javascript :: disable eslint next line 
Javascript :: como remover uma variável de um json 
Javascript :: query params vuejs 
Javascript :: javascript through array 
Javascript :: js refresh button 
Javascript :: nombre random js 
Javascript :: Get current active sheet name google appscript 
Javascript :: remove disable attr jquery 
Javascript :: How to remove text from a string in javscript 
Javascript :: useRoutes exact path match in react 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =