so i was doing the code foundations practice and i backspaced all of the coding and retyped it in the exact same format to see if i could run one on my own but when i press ‘run’ nothing happens. but if i paste the original text it works even though what i typed was the EXACT same. someone help me understand this?
We use color codes in CSS, but when we consider that JS is joined at the hip to CSS, we should be able to manipulate the style sheet, and if that means changing colors, then one may conclude we should know how CSS works with colors. As for remembering color codes, that isn’t necessary. There are lots of resources (color wheels, color pickers, theme pickers) online if we need to dial in a particular color.
All we really need to understand is how RGB colors are set which is covered in CSS.
We’re a little disadvantaged since we do not know what lesson you are on. Please post a link to the exercise in a reply so that we can share in the narrative.
Hello! How does the DrawName function know that each letter should be assigned one colour in the list in that order? Is it got to do with the way that DrawName function was programmed? If so, would it be possible to change the way a function is programmed to say make every two letter the same colour? Thanks
Without seeing the actual code, you bring up a list, which order is followed by the program. That would suggest we could adapt the list to contain the colors we choose. Copy and comment the list and paste it in again. Now change the colors to be alternatively the two colors you wish to use. There would be nothing else to change in the code if this is actually the case.
I’ve just started this exercise and am completely new to coding, but I was really curious about changing some of the color numbers to “null”. I honestly didn’t expect anything to happen but for some reason the color line with "null"in it takes the color of the previous color. So for example:
red = [0, 100, 63];
orange = [40, null, 60];
green = [75, 100, 40];
blue = [196, 77, 55];
purple = [280, 50, 60];
I changed Orange’s saturation number (If i’m going of the explanation that the colorscheme goes by HSL notation; H for hue is the ‘which’ of color, S for saturation means how ‘colored’ the color is, and L for luminance/V for value defines how ‘bright’ the light is (the two are defined slightly differently). source: [arraysurfer35729] comment on: How is the Color Spectrum Defined? ) to “null”. Now the originally orange letters turn red! If I now change Blue’s “hue” number to null the blue letters turn green! etc etc. If I now turn any one of green’s numbers to “null” both blue’s and green’s letters turn red as well etc etc.
Maybe this gets explained later on in the course, but does anyone know why that is? I thought "null’ was like a non existing variable, a literal empty or nothingness.
null is an object, so not ‘non-existing’, that would be undefined, which is not an object. it is also not an expected input for the HSL function. JS is a very determined language so will just do whatever it can to complete its task. I suspect it will cast null to 0 since it fits the expectations.
I’m kinda confused in the way that Variables are typed out.
In this exercise the Variable uses whether as in the previous Variable uses ’ '.
code used:
letterColors = [red, orange, green, blue, purple];
The above is assigning a string to the message variable. Single or double quotes are used to specify strings.
Numbers and booleans are among other primitive data types.
Square brackets are being used to assign an Array to the letterColors variable. Similarly, arrays have been assigned to the other variables such as red, orange etc. earlier in the exercise. Arrays are a type of Object which are non-primitive.