ProtoSchool / protoschool.github.io

The code that runs the ProtoSchool website. Visit https://proto.school for interactive tutorials on decentralized web protocols. Explore IPFS and Filecoin through code challenges, code-free lessons, and local events.
https://proto.school
Other
165 stars 67 forks source link

Lesson Feedback%3A Blog - Lesson 7 (Traverse through all posts, starting with the most recent) #839

Open kodikonas opened 1 year ago

kodikonas commented 1 year ago

The solution to this lesson is wrong.

The: const result = []; should be replaced with: let result = []; or var result = [];

The current solution for reference: const traversePosts = async (cid) => { const result = [] while (cid) { result.push(cid) const current = await ipfs.dag.get(cid) const prev = current.value.prev if (prev) { cid = prev } else { return result } } }