Responsive advice generator app using API - fetch method
Design comparison
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
- @IkuewumiPosted 12 months ago
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 helpful0@Poonamkothawade25Posted 12 months agoHey, 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 GitHubJoin 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