You mean why use JavaScript? I don't see Java being used in CoC2.
I figure they used JavaScript simply because flash is so outdated at this point only internet explorer and some specialized programs support it.
There are other options like unity or even unreal, however that is way overkill for a text adventure game.
They also had Fall of Eden as an example game that was already built in JavaScript.