使用Math.random()生成隨機數 0.7489584611780002
數字的.toString(n) 將數字轉換爲 n 進制的字符串 n取值範圍(0~36)"0.vbpjw8lipf9"
使用 substr 截取去除前面的 0.
使用 toUpperCase() 轉換爲大寫 L7NE21W7LMPdom
Math.random().toString(36).substr(2).toUpperCase();
使用這個方式能夠生成隨機顏色 #AF9838spa
'#' + Math.random().toString(16).substr(2, 6).toUpperCase();