How to override a single function in a core javascript library? Drupal 8's core comments module has a library "node-new-comments-link" with a file "node-new-comments-link.js".

This contains Drupal.behaviors.nodeNewCommentsLink = { ... } which calls another function in the library which in turn calls another function in the library function render(results) { ... }.

This render function controls the text used to show how many new comments a node has:
.text(Drupal.formatPlural(results[nodeID].new_comment_count, '1 new comment', '@count new comments'))


I want to use different text. (I want it just to say 'New' rather than 'x new comments').

I can replace the whole js file or the whole library and that works fine, but it's very heavy handed. It requires me to copy paste lots of complex code I don't need to understand.

Is there a way to override just this one render function?
You can enable interface translation for English in /admin/config/regional/language/edit/en

[x] Enable interface translation to English

and then you are able to change the string you are looking for in User Interface Translation.