Also worth noting is that most of SIM cards are Java cards, running Java applets
But I agree – Java to JavaScript is not the best comparison. Maybe a better one would be C programs written for a Unix system vs. C on a microcontroller: Same language; vastly different instruction set, OS and hardware capabilities and APIs available.
Unlike C on microcontrollers, Java Card applications are hardware and OS agnostic, though!
It's a UICC not a SIM card anyway.