Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Is the JavaScript Engine the same as the JavaScript interpreter?

Featured Replies

I am not entirely sure whether the JavaScript engine is the same thing as the JavaScript interpreter. Apparently, Chrome's JS engine is V8.

 

Your JS code isn't compiled up front like it is with a language like c++, in languages that require a compilation step, you would write your code then run a compiler on it after. Instead, your JS is passed through an interpreter at run time that converts your JS code to bytecode. There are typically a few steps to this, including an initial pass over of your code to allocate memory. This technically is a form of compilation, but at runtime you would get errors that a compile time language would prevent happening.

The interpreter is part of the engine, an engine likely does a bit more in terms of scheduling code and optimisation. I'm not really 100% sure to be honest, you typically don't need an understanding of low-level implementations like this unless you want to work on browsers or API specs.

I should add that with JavaScript it works slightly differently to an interpreter.  An interpreter like the one used in Bash scripts will interpret one line than execute then interpret the next line.

JavaScript has what is called Just in Time Compilation (JiT) where the whole program is complied just before it gets executed, things like closures would just not work if it was interpreted line by line.  There's some more information on it here https://stackoverflow.com/questions/7807235/javascript-just-in-time-compilation

These are nuances however and knowledge of this isn't really required for day to day working with the language.  The fact JS uses JiT is a detail you don't really need to care about.

I see JavaScript as a compile target and I either write in the latest Es version or TypeScript and just allow the transpiler (Babel in my case) to handle the output and make sure that it's going to run correctly.  (This is aside from the odd few polyfills that you might need to be added manually)
For Node you'd want Babel to compile to the correct Node version target e.g. Node 12 if you're running Node on a Lambda function.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.