Search code examples
javascriptnode.jsexpressv8

I got some questions while studying nodejs. Could you please help me?


I got some questions while studying nodejs.

  1. Does nodejs support all Java scripts? The official document says it uses the latest v8 engine. I don't think all JavaScript engines will be supported because they follow the JavaScript used by the v8 engine.

  2. How can I update to the latest v8 engine while using the old version nodejs?

  3. When implementing and running a server using nodejs express or nestjs, which portion of memory does most of the time occupy? I thought it would take up the most memory as soon as I build it.


Solution

    1. Does nodejs support all Java scripts? The official document says it uses the latest v8 engine. I don't think all JavaScript engines will be supported because they follow the JavaScript used by the v8 engine.

    All spec-compliant JS engines implement the same language specification, so the fact that Node uses V8 doesn't matter for this question. (This is very similar to how all (modern) browsers support the same JavaScript.)

    1. How can I update to the latest v8 engine while using the old version nodejs?

    You can't.

    Sometimes, there is a bit of wiggle room (e.g. early Node 14.x releases used V8 8.1, later 14.x releases updated to V8 8.4), but you couldn't just take e.g. an old Node 10.x build and stick V8 9.2 into it.
    And as Bergi says: just update Node.

    1. What accounts for the most memory when implementing and running a server using nodejs Express or nestjs?

    That totally depends on how you write your server.

    Once you observe a problem (whether it's memory, or performance, or something else), profile it to figure out what's going on.