We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a751b4b commit 62fbd93Copy full SHA for 62fbd93
1 file changed
javascript-question/hexColoeGne.js
@@ -0,0 +1,16 @@
1
+// const hexColorGenerator = () => {
2
+// const str = "0123456789abcdef";
3
+// let color = "#";
4
+// for(let i = 0;i<5;i++){
5
+// let randomIndex = Math.floor(Math.random() * str.length);
6
+// color+=str.charAt(randomIndex);
7
+// }
8
+// console.log(color)
9
+// return color;
10
11
+
12
+const randomHexGen = () => {
13
+ return `#${Math.random().toString(16).slice(2,8).padEnd(6,0)}`;
14
+}
15
16
+console.log(randomHexGen());
0 commit comments