Newbie Help creating a Plugin Action with JXA?

I got this working using AppleScript:

But I'd still like to see this in JXA, or if that's not supported in Plugins, then plain JavaScript.

Thanks!