Public
Edited
May 15
Fork of 1. Task
1 fork
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// your steps
Insert cell
listOfSocial = users.map(user =>{
return (user.social)
})
Insert cell
listOfSocial.length
Insert cell
//uses the spread operator to convert the Set back into an array.
uniqueList = [...new Set(listOfSocial)]
Insert cell
facebookNutzerA = listOfSocial.filter(cactus => cactus==='facebook')
Insert cell
facebookNutzerB = users.filter(cactus => cactus.social==='facebook')

Insert cell
facebookNutzerA.length
Insert cell
tiktokNutzer = listOfSocial.filter(item => item==='tiktok').length
Insert cell
instagramNutzer = users.filter(item => item.social==='instagram').length
Insert cell
Insert cell
// your steps
Insert cell
group1 = users.filter(user => user.age <=17)
Insert cell
group2 = users.filter(user => user.age > 17 && user.age <=24)
Insert cell
group3 = users.filter(user => user.age >24 &&user.age <=45)
Insert cell
group4 = users.filter(user=> user.age >45)
Insert cell
group1.length
Insert cell
group2.length
Insert cell
group3.length
Insert cell
group4.length
Insert cell
Insert cell
// your steps
Insert cell
top10 = users.filter(user => user.is_registered ===true)
.sort((a,b) => b.followers -a.followers)
.slice(0,10)
Insert cell
Insert cell
// your steps
Insert cell
listOfInterests= users.flatMap(user =>user.interests)
Insert cell
uniqueListInterests = [...new Set(listOfInterests)]
Insert cell

travelInterest = users.filter(user => user.interests.includes("travel")).length

Insert cell
foodInterest = users.filter(user => user.interests.includes("food")).length
Insert cell
booksInterest = users.filter(user => user.interests.includes("books")).length
Insert cell
sportInterest = users.filter(user => user.interests.includes("sport")).length
Insert cell
musicInterest = users.filter(user => user.interests.includes("music")).length
Insert cell
countList = uniqueListInterests.map(interestString =>{
return {
name: interestString,
count:users.filter(user => user.interests.includes(interestString)).length
}
})
Insert cell
countListSorted = countList.sort((a,b) =>b.count - a.count)
Insert cell
Lieblingsinteressen = countListSorted.slice(0,2)
Insert cell
Insert cell
Insert cell

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.
Learn more