fix(hooks): return values defaults to null in javascript

Fixes #6499
fix(hooks): handlers returning null/undefined don't change returnvalue in javascript

Fixes #6531
Merge pull request #6532 from sembrestels/js-hooks-fixes

Normalizes the JavaScript elgg.trigger_hook to behave like PHP's