Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

generate random color

function getRandomColor() {
    const availableCharacters = '0123456789ABCDEF';
    const availableCharacterLength = availableCharacters.length;

    let color = '#';

    for (let i = 0; i < 6; i++) {
      color += availableCharacters[Math.floor(Math.random() * availableCharacterLength)];
    }

    return color;
}

console.log(getRandomColor()); // #3BB46D
Comment

Random color

function getRandomColor() {
    const availableCharacters = '0123456789ABCDEF';
    const availableCharacterLength = availableCharacters.length;

    let color = '#';

    for (let i = 0; i < 6; i++) {
        color += availableCharacters[Math.floor(Math.random() * availableCharacterLength)];
    }

    return color;
}
Comment

random color generator

function randomColor(e){return '#'+Math.round(Math.random()*0xffffff).toString(16);}

randomColor(/*idk*/)
Comment

PREVIOUS NEXT
Code Example
Javascript :: revert order elements inside array 
Javascript :: show the time zone of browser javascript 
Javascript :: how to do get request in axios 
Javascript :: array with unique values javascript 
Javascript :: how to create onclick event on css class js 
Javascript :: ckeditor get instance from textarea 
Javascript :: discord js send message to specific channel 
Javascript :: json deep dot 
Javascript :: match 
Javascript :: jquery if element appears 
Javascript :: nodejs end process 
Javascript :: xlsx to csv javascript 
Javascript :: javascript detectar la pagina 
Javascript :: vuex getters 
Javascript :: handle onchange react 
Javascript :: how to get current formatted date dd/mm/yyyy in javascript 
Javascript :: sort numbers in javascript 
Javascript :: Date toLocaleDateString Javascript 
Javascript :: react sign in with linkedin 
Javascript :: regex[ress for password 
Javascript :: comparing two array of objects in javascript returning differences 
Javascript :: react native font awesome 
Javascript :: how to increment variable value in javascript 
Javascript :: how to code javascript 
Javascript :: javascript base64 to length 
Javascript :: do somthing after page completly load jqery 
Javascript :: How to reset ReactJS file input 
Javascript :: Uncaught (in promise) DOMException: Failed to load because no supported source was found. 
Javascript :: puppeteer headless ubuntu server install required 
Javascript :: how to remove item from array javascript 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =