How to trigger Notification Centre notification from JavaScript? The other question asks the same but using AppleScript. Apple introduced JavaScript as a new language for Automation in OS X 10.10.
From Terminal,

osascript -l JavaScript -e "app=Application.currentApplication(); app.includeStandardAdditions = true; app.displayNotification('Hello, world', {withTitle: 'Title'})"


From Script Editor,

app = Application.currentApplication()
app.includeStandardAdditions = true
app.displayNotification('Hello, world', {withTitle: 'Title'})