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 :: graphqlHTTP is not a function 
Javascript :: find label jquery 
Javascript :: nodejs make directory 
Javascript :: select a form by name jquery 
Javascript :: remove string from array in js 
Javascript :: get current page name in javascript 
Javascript :: how to open a new tab in react 
Javascript :: console log add new line 
Javascript :: javascript binary to int 
Javascript :: jquery click on parent but not child 
Javascript :: delegate click in jquery 
Javascript :: dropzone clear files 
Javascript :: pass number as a prop in react 
Javascript :: vibrate javascript 
Javascript :: js sleep sync 
Javascript :: numeros primos js 
Javascript :: how to convert number to array in javascript using Array.from 
Javascript :: js difference between two numbers 
Javascript :: installation of material ui core using npm 
Javascript :: import json javascript 
Javascript :: resolveJsonModule 
Javascript :: codeigniter raw query 
Javascript :: auto reload page javascript 
Javascript :: javascript add day to date 
Javascript :: add event listener on modal close 
Javascript :: jquery select option auto select 
Javascript :: javascript replace multiple spaces with single space 
Javascript :: open a new tab when clicking on a link react 
Javascript :: detect button click jquery 
Javascript :: js split last occurence 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =