Dit project is gemaakt en bedoeld voor mensen die op zoek zijn naar inspirerende quotes die gaan over web design en web development. Het is een single page web app die volledig is gemaakt met HTML, CSS en JavaScript waarbij er gebruikgemaakt wordt van de fetch API om data op te halen. Vervolgens worden er op basis van de opgehaalde data quotes gegenereerd.
You can set a local variable, or even global if you have to use it multiple functions.
lines 10,13, and 33 all finish with ;
But since the rest of code does not, better remove these for consistency
Sometimes, javascript gives you a nicer alternative to if else blocks
This code:
if (avatarImgURL != '') { // Check if there is an image
document.querySelector('.avatar').src = avatarImgURL
}
else { // If there is no image
document.querySelector('.avatar').src = 'image_skeleton.png'
}
Can be refactored to a short-circuit:
document.querySelector('.avatar').src = (avatarImgURL || 'image_skeleton.png')
Declaring variables on top of the page improves readability a good amount.
The rest is nicely set up, you could make the fetching funtion async, but the current state implementation seems to flow nicely.
Scan your buddy's repository
is there a repo description at the top?
Yes, but it's the forked WAFS description.
Is there a link to the live web app provided with GitHub Pages?
Yes
Is the repo open to issues?
Yes
Does it include a gitignore
Yes
Is the concept described well in the readme?
The read
Is the API described in the readme?
Only a link is shown.
Code
A lot of times,
document.querySelector
is used where a variable would be more readable and efficient.You can set a local variable, or even global if you have to use it multiple functions.
lines
10
,13
, and33
all finish with;
But since the rest of code does not, better remove these for consistencySometimes, javascript gives you a nicer alternative to
if else
blocks This code:Can be refactored to a
short-circuit
:document.querySelector('.avatar').src = (avatarImgURL || 'image_skeleton.png')
Declaring variables on top of the page improves readability a good amount.
The rest is nicely set up, you could make the fetching funtion
async
, but the current state implementation seems to flow nicely.