Skip to main content
I researched some more and found some new info
Source Link
SirPython
  • 13.3k
  • 3
  • 38
  • 93
  1. I've used that before in my code. I don't see why you couldn't use it(I have also seenfind it beis often used in other libraries) as an "initializer" that sets up the code and DOM for the library rather than forcing the user of the library to have to call an initialization function.
  2. It depends. If you need to interact with the DOM right away(as in, find elements, change properties, or set element events), the code has to be at the bottom of the body. If it's just function declarations and definitions, you can keep your code in the head
  3. Is this a question?
  4. There is nothing that really pops out. You have very nice spacing in your code(everything isn't bunched together) and your formatting is perfect(in my opinion).
  1. I've used that before in my code. I don't see why you couldn't use it(I have also seen it be used in other libraries)
  2. It depends. If you need to interact with the DOM right away(as in, find elements, change properties, or set element events), the code has to be at the bottom of the body. If it's just function declarations and definitions, you can keep your code in the head
  3. Is this a question?
  4. There is nothing that really pops out. You have very nice spacing in your code(everything isn't bunched together) and your formatting is perfect(in my opinion).
  1. I've used that before in my code. I find it is often used in libraries as an "initializer" that sets up the code and DOM for the library rather than forcing the user of the library to have to call an initialization function.
  2. It depends. If you need to interact with the DOM right away(as in, find elements, change properties, or set element events), the code has to be at the bottom of the body. If it's just function declarations and definitions, you can keep your code in the head
  3. Is this a question?
  4. There is nothing that really pops out. You have very nice spacing in your code(everything isn't bunched together) and your formatting is perfect(in my opinion).
Source Link
SirPython
  • 13.3k
  • 3
  • 38
  • 93

  1. I've used that before in my code. I don't see why you couldn't use it(I have also seen it be used in other libraries)
  2. It depends. If you need to interact with the DOM right away(as in, find elements, change properties, or set element events), the code has to be at the bottom of the body. If it's just function declarations and definitions, you can keep your code in the head
  3. Is this a question?
  4. There is nothing that really pops out. You have very nice spacing in your code(everything isn't bunched together) and your formatting is perfect(in my opinion).