Cascading WikiProcessors is not supported for external lexers like for javascript.
Trac's own processors for advanced tables and paragraphs (lend from HTML tag) are the exceptions. So the following works in some way:
{{{#!js
var a = 1;
}}}
{{{#!div style="color:red"
{{{#!js
var b = 2;
}}}
}}}
{{{#!js
alert(b);
}}}
But it's breaking the code into pieces as a side-effect of cascaded div's with default styling (includes margin/padding).