Birmingham | 26-ITP-May | Gabriel Pawuoi | Sprint 3 | Programmer Humour - #544
Birmingham | 26-ITP-May | Gabriel Pawuoi | Sprint 3 | Programmer Humour#544KhotKeys wants to merge 2 commits into
Conversation
hey-hammad
left a comment
There was a problem hiding this comment.
Good implementation overall. I have a few suggestions around DOM element checks, avoiding repeated DOM queries. Thanks
| }) | ||
| .then(function (data) { | ||
| console.log(data); | ||
| document.getElementById("comic-img").src = data.img; |
There was a problem hiding this comment.
would it be better to if we cache the comic-img element instead of querying the DOM twice? It would make the code a bit cleaner and avoid repeating the selector.
There was a problem hiding this comment.
Also can we assume that elements comic-img and error are always available, and the absence will not break the code?
There was a problem hiding this comment.
would it be better to if we cache the comic-img element instead of querying the DOM twice? It would make the code a bit cleaner and avoid repeating the selector.
All changes are fully fixed, thanks for the feedback
Learners, PR Template
Self checklist
Changelist
Learnt about fetch and the DOM, specifically: