diff --git a/js/github-comments.js b/js/github-comments.js
index d2bcc5a..a052de6 100644
--- a/js/github-comments.js
+++ b/js/github-comments.js
@@ -16,14 +16,14 @@ async function getComments(repo_name, comment_id, page_id, acc )
{
const comment = comments[i];
const date = new Date(comment.created_at);
- acc += "
";
+ acc.push( "" );
}
// Call recursively if there are more pages to display
@@ -51,10 +51,14 @@ function DoGithubComments(repo_name, comment_id)
try {
// post button
const url = "https://github.com/" + repo_name + "/issues/" + comment_id + "#new_comment_field";
- const acc = ("");
- const comments = await getComments(repo_name, comment_id, 1, acc);
+ const comments = await getComments(repo_name, comment_id, 1, []);
const commentsElement = document.getElementById('gh-comments-list');
- commentsElement.innerHTML = comments;
+
+ // choose one of the next two lines to determine display order (newest or oldest first).
+ const commentsHtml = comments.join(''); // oldest first
+ // const commentsHtml = comments.reverse().join(''); // newest first
+
+ commentsElement.innerHTML = "" + commentsHtml;
} catch (err)
{
console.log( err.message );