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

Submitted

Responsive advice generator app using API - fetch method

#accessibility#fetch#semantic-ui

@Poonamkothawade25

Desktop design screenshot for the Advice generator app coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
  • API
2junior
View challenge

Design comparison


SolutionDesign

Solution retrospective


I had difficulty integrating API in my project. I am not very familiar with asynchronous javascript. I was confused as to which method to use to integrate API. Would it be better to use Asynchronous javascript? Also, since the text length is variable, what can I use to make sure that the end double quotes will be appended exactly after end of the sentence?

Community feedback

@Ikuewumi

Posted

Hi! Good project, About your question, you can put quotes in strings by prefixing them with the backslash, Like this:

const str = "\"Be a good lover\""
console.log(str) // "Be a good lover"

And use interpolation for easier concatenation of strings, like this

const str = "World"
const str2 = `Hello ${str}`
console.log(str2) // Hello World

One more thing, please avoid mutating the innerHtml of an element directly if you can,new elements should be added via document.createElement('span') or templates

Overall, good project. Hope these tips help. Happy coding, Ayobami

Marked as helpful

0

@Poonamkothawade25

Posted

Hey, Thank you so much for your feedback. I will try this for string. Searched more about innerHTML and createElement and got to learn lot of things. Will make the changes in my code as per your tips@Ikuewumi

0

Please log in to post a comment

Log in with GitHub
Discord logo

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord