Conversation
| }) | ||
| .then(body => { | ||
| // pullNewsObject(body); | ||
| createNewsContent(body); |
| //Create .innerHTML of each news article div. | ||
|
|
||
| function articleTemplate (article) { | ||
| let authorVar = ""; |
There was a problem hiding this comment.
Code would be slightly cleaner if declaration and assignment was combined into single step. That would also allow you to use const instead of let
| function createSideBarContent(news) { | ||
| news.articles.forEach(item => { | ||
| if (item.content !== null && item.source.name !== "Bloomberg") { | ||
| const sideBar = document.querySelector(".news_sidebar"); |
There was a problem hiding this comment.
featureBox and sideBar lookup can be taken outside the forEach. Will save you having to run querySelector up on each loop iteration.
|
|
||
|
|
||
| //Adds more items to the sidebar as the page number for main article increases | ||
| function updateSideBarUrl(number) { |
There was a problem hiding this comment.
This is good, but I would suggest not putting the fetch call in this function. Use this function just to generate the URL and return it. Then the returned value can be used to call generateSideBar. This will reduce the amount of responsibility this function has and make it easier to test later as we will discuss later this week.
|
It would be great to see a README that explains what the project does |
No description provided.