And see that snipet
function draw() {
const canvas = document.getElementById("canvas");
if (canvas.getContext) {
const ctx = canvas.getContext("2d");
}
}
The difference is that canvas.getContext() is a method and canvas.getContext is an affirmation.
So when I assecure that canvas.getContext that is without the () I could pass by a boolean text if is true of false, the same I can't do with a method, the method isn't true or false.
Rute Bezerra de Menezes Gondim
Ps.: What I don't like in the function draw() is that when use the function draw that is a good practice teach in the mdn that have a small problem that is an aesthetic point of view, I have to write all the code inside it that function the function doesn't export its result with a return command, so would have some people that will give it up, is only that the result isn't exported for outside the function of the way is write but with the return could.
Rute Bezerra de Menezes Gondim
No comments:
Post a Comment