Hi guys can u help me can't find my mistake I want to change td color with math random when my td%!=O | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 2

Hi guys can u help me can't find my mistake I want to change td color with math random when my td%!=O

https://jsfiddle.net/vxnjf88q/

14th May 2017, 11:22 AM
Kristina Hakobyan
Kristina Hakobyan - avatar
15 Réponses
+ 2
u use jequri
14th May 2017, 12:37 PM
Kristina Hakobyan
Kristina Hakobyan - avatar
+ 2
but I don't understand why u use to string method
14th May 2017, 12:44 PM
Kristina Hakobyan
Kristina Hakobyan - avatar
+ 2
ok thx but I get it more easy wait
14th May 2017, 12:53 PM
Kristina Hakobyan
Kristina Hakobyan - avatar
14th May 2017, 12:56 PM
Kristina Hakobyan
Kristina Hakobyan - avatar
+ 1
Here you go.. A configurable table with alternative column color (modified from @Kristina code) https://code.sololearn.com/W42z9i0c7qMl/?ref=app
14th May 2017, 11:49 AM
Calviղ
Calviղ - avatar
+ 1
good work but I do it I want with math random because wanna get other colors in the colls rgb are
14th May 2017, 12:23 PM
Kristina Hakobyan
Kristina Hakobyan - avatar
+ 1
but how adding in my table
14th May 2017, 12:29 PM
Kristina Hakobyan
Kristina Hakobyan - avatar
+ 1
Check out my code again.
14th May 2017, 12:35 PM
Calviղ
Calviղ - avatar
+ 1
but ira more easy don't agree with me
14th May 2017, 1:49 PM
Kristina Hakobyan
Kristina Hakobyan - avatar
+ 1
Yes, you're right.
14th May 2017, 2:40 PM
Calviղ
Calviղ - avatar
0
then you need to use random number to get random color colorRandom = Math.floor(Math.random()* 0xFFFFFF).toString(16);
14th May 2017, 12:29 PM
Calviղ
Calviղ - avatar
0
No, I use Javascript only. ES6 Javascript allows us to use $ in `string `
14th May 2017, 12:38 PM
Calviղ
Calviղ - avatar
0
Please note that your code will keep on add extra table if you enter the values more then one time.
14th May 2017, 12:43 PM
Calviղ
Calviղ - avatar
0
I used toStrong (16) to convert the default decimal number to hex number for color code. This conversion not exactly correct, since 3digit hex like #fff also equal to #ffffff, but the error is minimum.
14th May 2017, 12:47 PM
Calviղ
Calviղ - avatar
0
Should be the same.
14th May 2017, 1:10 PM
Calviղ
Calviղ - avatar