4

Hello I've read this in a book,

The fact that the case expressions are evaluated at run-time makes the JavaScript switch statement much different from (and less efficient than) the switch statement of C, C++, and Java. In those languages, the case expressions must be compile-time constants of the same type, and switch statements can often compile down to highly efficient jump tables.

which states that JS has a lower performance for its switch statements unlike Java/C++ and knew that is because it doesn't implement a jump table for switch statements unlike Java/C++. I'm wondering why JS doesn't implement the jump table for switch statement and Java/C++ do? Is that because JS is a dynamic and weak language or because it usually get interpreted? If that because it is an interpreted language what is the case for V8 engine as it compiles JS.

  • Comments are not for extended discussion; this conversation has been [moved to chat](https://chat.stackoverflow.com/rooms/206039/discussion-on-question-by-nour-el-deen-abou-el-kassem-why-javascript-doesnt-imp). – Samuel Liew Jan 16 '20 at 05:57

0 Answers0