No.
Javascript can be used in various places like rules, but if you want to use it as a transformation on a label, then you put it in the /transform folder just like you did your MAP file.
You can specify where to use it in the [state presentation] part of your Item label, just like you did your MAP directive.
(OH3 users have to a little differently)
You can’t.
You can only display Item states.
You can of course process some Item states in a rule, and then postUpdate the result to some other Item.
You can transform an Item state for display, but you only get the one Item state to process and cannot reference other Items in that context.
Doing it in a rule gives you access to all Items.