//access the specific element of the statuses (which is an array)
//It is important to get familiar with the object/ array format of the data of interest
//use [x] to access the element in an array
//use .x to access the element in an object based on keys
tweets.statuses[0]
tweets.statuses[0].geo
tweets.statuses[0].user.id
searchMetadata=tweets.search_metadata
statuses[0]
text=statuses[0].text
textId=statuses[0].id
userId=statuses[0].user.id
userName=statuses[0].user.name
{
lettexts=[]
for(letiinstatuses){
// we can easily loop through the elements in an array
letcurrentText=statuses[i].text
texts.push(currentText)
}
returntexts
}
// get the tweets IDs as an array
{
letemptyArray=[]
for(letiinstatuses){
// we can easily loop through the elements in an array
letcurrentArray=statuses[i]
lettweetId=statuses[i].id
emptyArray.push(tweetId)
}
returnemptyArray
}
// Your code here
{
letemptyObject={}
letemptyArray=[]
for(letiinstatuses){
letcurrentTweetId=statuses[i].id
letcurrentTweetText=statuses[i].text
emptyObject[currentTweetId]=currentTweetText
}
returnemptyObject
}
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.