Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

All comments

  • Ali Akbar Qasimi• 850

    @Ali-Akbar-Qasimi

    Posted

    Hello my dear brother,

    This is very good I am proud of you.

    Marked as helpful

    0
  • Ali Akbar Qasimi• 850

    @Ali-Akbar-Qasimi

    Posted

    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.

    0
  • Ali Akbar Qasimi• 850

    @Ali-Akbar-Qasimi

    Posted

    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.

    0