I think probably if you worked through line-by-line you’d find a lot of it is valid ES5 as well (and GoJa does actually support a lot of ES6, see https://github.com/dop251/goja/milestone/1?closed=1).
Also, what features do you need to code in JavaScript to extend PocketBase functionality?