portfolio/src/main/webapp/comments.js
// traverses the comments tree and calls 'addCommentToDom' with the correct offset
traverses the comments tree and calls 'addCommentToDom' with the correct offset
traverses the comments tree and calls ' addCommentToDom ' with the correct offset
function buildCommentsTree(commentsMap, comment, depth, authState) {
  addCommentToDOM(comment, depth, authState)
  for (const i in comment.replies) {
    const replyId = comment.replies[i];
    const reply = commentsMap[replyId]
    buildCommentsTree(commentsMap, reply, Number(depth + 1), authState);
  }
}
function buildCommentsTree ( commentsMap , comment , depth , authState ) { addCommentToDOM ( comment , depth , authState ) for ( const i in comment . replies ) { const replyId = comment . replies [ i ] ; const reply = commentsMap [ replyId ] buildCommentsTree ( commentsMap , reply , Number ( depth + 1 ) , authState ) ; } }
traverses the comments tree and calls 'addCommentToDom' with the correct offset
traverses the comments tree and calls ' addCommentToDom ' with the correct offset
// add current comment to dom // iterate over all replies in the map, add them as the children of the current comment