You may be iterating outside of the bounds of the comments in the response:
vvvvv
for(let i = 0; i < 5 ; i++ ){
var comment_list = comment_object();
comment_list.set_properties( result[i] );
comment += comment_list.get_html();
}
You're looping 5 times to extract values from the result, however there's no guarantee that the returned array is going to contain 5 items. You already check for length, so instead loop based on the length of the array:
for (let i = 0; i < result.length; i++) {
Or you can alternatively use the more modern
of
operator:
for (const item of result) {