scrimba
Frontend Career Path
Essential JavaScript concepts
Twitter Clone
Add some awesome icons
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

AboutCommentsNotes
Add some awesome icons
Expand for more info
index.js
run
preview
console
import { tweetsData } from './data.js'
const tweetInput = document.getElementById('tweet-input')
const tweetBtn = document.getElementById('tweet-btn')

tweetBtn.addEventListener('click', function(){
console.log(tweetInput.value)
})

function getFeedHtml(){
let feedHtml = ``
/*
Challenge:
1. Inside each span that has a class of "tweet-detail",
add an <i> tag.
2. Give each <i> tag the classes it needs to render the
correct icons next to the numbers.
The classes you will need are:
fa-regular,
fa-solid,
fa-comment-dots,
fa-heart,
fa-retweet
*/

tweetsData.forEach(function(tweet){
feedHtml += `
<div class="tweet">
<div class="tweet-inner">
<img src="${tweet.profilePic}" class="profile-pic">
<div>
<p class="handle">${tweet.handle}</p>
<p class="tweet-text">${tweet.tweetText}</p>
<div class="tweet-details">
<span class="tweet-detail">
${tweet.replies.length}
</span>
<span class="tweet-detail">
${tweet.likes}
</span>
<span class="tweet-detail">
${tweet.retweets}
</span>
</div>
</div>
</div>
</div>
`
})
return feedHtml
}

function render(){
document.getElementById('feed').innerHTML = getFeedHtml()
}

render()

Console
/index.html
-4:37