Latest solutions
done this challenge using sass, javascript, html, media query,
#sass/scssSubmitted almost 2 years ago
Latest comments
- @HamidQasimi90@Ali-Akbar-Qasimi
Hello my dear brother,
This is very good I am proud of you.
Marked as helpful - @ehsanqasimi@Ali-Akbar-Qasimi
very good. This is a very hard challenge. It is wonderful. Try writing cleaner code not trowing a bunch of code. It is not based on the amount of code you write it is based what you code does. anyway you did your best. mashallah my brother.
- @johnrookie-coder@Ali-Akbar-Qasimi
first of all you did a great work
you can make a function that fetch the advice and on the dice listen for a click and run the function that fetch the advice , that way you are not suppose to reload the page , and at the first line of your code you can call that function so that the advice will be fetched at the first also.
getNewAdvice()
let dice = document.querySelector('.dice') let header = document.querySelector('.header') let advice = document.querySelector('.advice')
dice.addEventListener('click',()=>{ getNewAdvice() })
async function getNewAdvice(){ let response = await fetch('https://api.adviceslip.com/advice') let data = await response.json() console.log(data) header.textContent = 'Advice #' + data.slip.id advice.textContent = data.slip.advice }
this is how i made it, hope it helped you.