Any JavaScript code runs on any browser. How JavaScript code run in a browser ? Because every browser has JavaScript engine. As a google chrome has V8 engine, Mozilla Firefox has SpiderMonkey and etc . So when any JavaScript code comes to the browser then Parser will execute the code line by line and produce a data structure called Abstract Syntax Tree (AST). If Parser produce the AST then the code translate to Machine Code using of AST. Once the code converted into Machine Code then the actual code will run.