Why javascript solutions are slower than java.

I have been coding in LC for quite a while. I usually code in both java and javascript. Lately I have been coding in both java and JS to compare the performance. I have observed a lot of JS solutions are slower and have high runtime when compared to the corresponding Java solution. See the below picture.
image

For same problem, the JS solution has far higher runtime,almost 7 times of java solution. The logic is same in both of the solutions. Why is it? Is this difference due to how LC handles JS and java solutions or Does it have to do something with the individual languages? I'm really interested in knowing the reason.
Thank you.

Comments (2)