Skip to content
Discussion options

You must be logged in to vote

Resolved. I did not know how to use slice().

if (page > 1) {
  const result = data.slice(limit * page - limit, limit * page);
  return res.status(200).json(result);
} else {
  const result = data.slice(0, limit);
  return res.status(200).json(result);
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by nehiro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant