@dennistobar Wow, again thank you so much for taking time to look at my code and give me some pointers!!!
I can see how optional chaining would help, sometimes I unexpectedly get 'nulls' and that may be why. Am I correct in understanding that the syntax for querySelector would be var title = document.querySelector.?("h1");
I'm not really understanding at all what you mean by libraries! Would you be down to break down for me what's happening in that function? I am very intrigued, it looks like you could plug "qs" and whatever class you wanted right in to that style property manipulation which would def save me time once set!
The querySelector could return null, but you could use ?. when the next function or parameter is not expected to be null (and it's ok with that). A full descriptive article is here
Libraries?... I suggest if you use the same functions every time, everywhere, you can write a few functions as helpers to make the development in Javascript easier -and friendly.
For example, I said qs as a shortcut to document.querySelector, you would create another function as qsa as a shortcut to document.querySelectorAll, and so on...
If you feel lost, don't be afraid; in the next chapters or parts of your course, you will learn about functions and how to improve the readability of your javascript :)
Thank you for elaborating @dennistobar! We're still going over functions a lot, so I'm going to focus on my lessons first then certainly come back to what you're saying bc I'm all for saving time!
For further actions, you may consider blocking this person and/or reporting abuse
@dennistobar Wow, again thank you so much for taking time to look at my code and give me some pointers!!!
I can see how optional chaining would help, sometimes I unexpectedly get 'nulls' and that may be why. Am I correct in understanding that the syntax for querySelector would be
var title = document.querySelector.?("h1");
I'm not really understanding at all what you mean by libraries! Would you be down to break down for me what's happening in that function? I am very intrigued, it looks like you could plug "qs" and whatever class you wanted right in to that style property manipulation which would def save me time once set!
The querySelector could return null, but you could use
?.
when the next function or parameter is not expected to be null (and it's ok with that). A full descriptive article is hereLibraries?... I suggest if you use the same functions every time, everywhere, you can write a few functions as helpers to make the development in Javascript easier -and friendly.
For example, I said
qs
as a shortcut todocument.querySelector
, you would create another function asqsa
as a shortcut todocument.querySelectorAll
, and so on...If you feel lost, don't be afraid; in the next chapters or parts of your course, you will learn about functions and how to improve the readability of your javascript :)
Thank you for elaborating @dennistobar! We're still going over functions a lot, so I'm going to focus on my lessons first then certainly come back to what you're saying bc I'm all for saving time!