Hello there, I know JS is weakly typed, but I’m currently following a very old game coding tutorial from fCC on YouTube, and in the code, the presenter often doesn’t assign types to the variables at all.
For instance, in declaring the canvas width and height, he writes:
CANVAS_HEIGHT = 1000;
CANVAS_WIDTH = 500;
For an object, he also declares the variable without assigning a type:
enemy = {object properties};
Is this poor practice, or is it okay? In what circumstances might you want to not assign a type?
please note that you do not assign types to variables in javascript at all
using let or const is a different thing than assigning a type to a variable
anyway, you can do that when you are not using strict mode (which nowadays is pretty much everywhere), older JS uses this tricks sometimes, it’s highly not advised
please also note that that is not the correct timestamp, that is the length of the video
Thanks for the response, and sorry, the timestamp should have been 1:30:05. Oops.
Apols, I’m still getting to know the jargon. So, let and const are ‘qualifiers’? Is that a better description? Whereas a type would be int, string, float etc. Am I right in thinking that the qualifier is unnecessary then?