I'm Calin Baenen – AKA KattyTheEnby – a programmer born October 30th, 2006.
I love programming, it has been my passion since I was a kid, and will forever be my passion.
Since you called the makeColor() function with the string Example, you would get the string "6912097109112108101". This string contains chars that are greater than 6 which means your canvas element will be overwritten by your document.writeln().
I'm Calin Baenen – AKA KattyTheEnby – a programmer born October 30th, 2006.
I love programming, it has been my passion since I was a kid, and will forever be my passion.
I'm Calin Baenen – AKA KattyTheEnby – a programmer born October 30th, 2006.
I love programming, it has been my passion since I was a kid, and will forever be my passion.
I did use
console.log()to debug my code.document.writelnis a different part of the program.Did you not fully (thoroughly*) read the post? :p
let's say you had an HTML file like this:
as soon this line gets executed
your HTML will be converted to this:
As you can see, this removes your canvas element from the DOM which will lead
document.getElementById("result")to fail.Now let's take a look at your code
Since you called the
makeColor()function with the stringExample, you would get the string"6912097109112108101". This string contains chars that are greater than 6 which means your canvas element will be overwritten by yourdocument.writeln().It wasn't overriden, though, it just stayed black (which was the default color I gave it).
Did you set the color through CSS? In that case, may I see your CSS file?
I set the color using inline (element) styling.