Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript get random string char

const array = [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ];
const string = "abcdefghijklmnopqrstuvwxyz";

// random item from Array
console.log(array[Math.floor(Math.random() * array.length)]);

// random Char from String
console.log(string[Math.floor(Math.random() * string.length)]);
Comment

get random letter js

const alphabet = "abcdefghijklmnopqrstuvwxyz"

const randomCharacter = alphabet[Math.floor(Math.random() * alphabet.length)]
Comment

random letter from a name js

let myName = 'yourname';
let randomChar = Math.trunc(Math.random() * myName.length);
console.log(myName.charAt(randomChar));
Comment

PREVIOUS NEXT
Code Example
Javascript :: node js get ip 
Javascript :: react native heroicons 
Javascript :: json parse array local storage 
Javascript :: document get element by id style 
Javascript :: javascript create array of objects with map 
Javascript :: flutter text with icon 
Javascript :: react get current date yyyy-mm-dd 
Javascript :: javascript array remove empty strings 
Javascript :: regex match entire words only js 
Javascript :: hide and show in angular 8 
Javascript :: ng build staging 
Javascript :: express.json 
Javascript :: onclick checkbox hide div and unchecked show div 
Javascript :: compress string javascript 
Javascript :: angular add object to array 
Javascript :: how to add two elements in one path in react router v6 
Javascript :: get value before change and after change js 
Javascript :: python object to json 
Javascript :: useffect compare previous value to current 
Javascript :: asp.net core 3.1 convert system.string[] to javascript 
Javascript :: javascript open new tab window 
Javascript :: js string check case 
Javascript :: convert utc to date javascript 
Javascript :: number pyramid javascript 
Javascript :: move dom element to another parent 
Javascript :: check if function is async javascript 
Javascript :: react native width auto 
Javascript :: how to make slide js in owl carousel auto 
Javascript :: javascript hover event 
Javascript :: check if body has class javascript 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =