Skip to content

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

Open
@kodikonas

Description

@kodikonas

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
}
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions