Why does Java code need to be compiled but JavaScript code does not

Viewed 15345

How come code written in Java needs to be compiled in byte-code that is interpreted by the JVM, but code written in a language like JavaScript does not need to be compiled and can run directly in a browser?

Is there an easy way to understand this?

What is the fundamental difference between the way these two languages are written, that may help to understand this behavior?

I am not a CS student, so please excuse the naivete of the question.

4 Answers
Related