resizing_html_canvas_element.htm

Hello & Thanks ,
From your example/article 'resizing_html_canvas_element.htm’
I am getting this error: Uncaught SyntaxError: Unexpected token ILLEGAL
From this statement: var myCanvas = document.getElementById(“canvas”);

window.addEventListener("resize", resizeCanvas, false);
 
function resizeCanvas (e) {
var myCanvas = document.getElementById(“canvas”);
 
myCanvas.width = document.documentElement.clientWidth;
myCanvas.height = document.documentElement.clientHeight;
}	

Can you tell me why ?
Thanks…

Yeah, you copied over curly quotes from pasting the code into Word or something. You have quotes like and , but you should be using quotes like ".

I think that may be a mistake in the tutorial. I have it as curly braces as well…which is really bizarre! It should be fixed now :slightly_smiling:

Ah , ThANKS

This is the third time I’ve seen this come up this week. I kinda wonder how hard it would be for languages to recognize smart quotes in code. Probably a lot harder than it sounds like it should be from the outside, I’m sure.

I don’t think it’d be super hard, there’s just no convention for it and PL designers historically haven’t focused much on human factors or linguistic pragmatics. E.g. Ruby has =begin and =end; it’s hard to see how that’s much easier than using directional quotes.

The hard part would be retrofitting this sort of quote into many of the popular, existing languages. It’s like replacing the var or function keywords in AS4, or maybe even worse. There’s just so much momentum and existing code that changes need to be really compelling, and I’m not sure that problems like what we see above us here quite meet that definition.