wwb00
  • wwb00
HTML Canvas Function I have been writing some HTML canvas code in order to make a landscape. The code will not execute properly. What is my syntax error? Thanks, Benjamin var canvas = document.getElementById("mycanvas"); var ctx = canvas.getContext("2d"); var llocation = 600; var length = 360; var linewidth = 2; var testInt = length/(linewidth*2); var wColour = "#994c00"; for(i=0;i
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
schrodinger
  • schrodinger
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
woodrow73
  • woodrow73
The variable i in the for loop header needs a var before it ``` for(var i=0;i
wwb00
  • wwb00
I'll try it Thanks!
wwb00
  • wwb00
How do I fix the wColour issue? it is declared earlier in the function.

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

woodrow73
  • woodrow73
That's my bad, I didn't see you declare wColour up above those if/else statements. Syntactically, in javascript, looks good. Perhaps my mind is still too java, I see var x = 1; and I tend to immediately think x is being declared for the first time lol. ``` ctx.beginPath(); ctx.strokeStyle = wColour; ctx.lineWidth ``` Looks good, except you don't appear to be setting lineWidth to a value; and I assume your isEven() function is elsewhere. Here's a bit of sample code you might find helpful to play with: http://jsbin.com/yuxiroqexu/edit?html,js,output

Looking for something else?

Not the answer you are looking for? Search for more explanations.