Some confusion about JavaScript?

JavaScript is a scripting language executed through an interpreter. We know that there is a js interpreter in the browser, so it can run in the browser, and the other running environment is the Node.js environment, so can it run in other environments apart from these two environments? Can it be run as long as the js interpreter exists? What is the js interpreter? Script files, programs, or just a few lines of code? Can the js interpreter be embedded in the machine kernel and Vr devices? There is also the smallest white question, the browser is software, right? What"s the difference between software and programs? I have a non-professional background and lack of theoretical knowledge, so I hope all the gods will not hesitate to give me some advice. Some Baidu has come out, but some seem to be ambiguous! Thank you!

Mar.13,2021

if you get started, this knowledge can be ignored directly at first

    The
  1. interpreter compiles your code into machine executable code, so as long as you have an interpreter, you can run
  2. on other platforms.
  3. the interpreter is also a program and is written in code. Its function is relatively complex and requires abstract compilation principles plus low-level knowledge
  4. .
  5. of course, the interpreter can be embedded in other devices. Generally, the function of embedded devices is relatively simple, so the castrated version of the interpreter is used
  6. Software is a collection of programs

1. You can think of software = program, most of the software we can see is a program, of course, what is driving is also a program
2.js interpreter is also a program, you can understand it as a program that can understand js scripting language and make corresponding actions
3. You need to know about common programming languages, what is a static language and what is an interpretive scripting language
4. Theoretically, the js interpreter can be embedded in any device with cpu, and memory, but it's just a performance problem. Now many Internet of things devices can also be developed with js


    .
  1. High-level languages have two camps, compiled and interpreted. The former source program will be compiled to generate platform-specific binaries, so that the machine can directly call the binary code into memory for execution at run time, while the latter will generally have an interpreter that throws the source code into the interpreter at runtime. The interpreter then translates it into executable code and executes it. So, the js interpreter you can understand it as a program that translates js code into executable code. Of course, if the environment is right, you can run js where there is an interpreter. As far as I know, for example, you can run in ps and ae (but adobe gave it a name of jsx, not the jsx of react.) In addition, some embedded developers are also useful in js scenarios.
  2. as for the question of "what is the interpreter", it's a big question, and I don't think I can explain it to you (laugh and cry?), you can go through justjavac's v8 (the most commonly used interpreter of js, based on which node.js is implemented). If you really want to get started, you can learn Lua (which is easy to learn) on the basis of learning js well, and then write an interpreter for Lua (the Lua chapter in "Seven weeks and Seven languages" has a simple implementation, which you can take a look at).
  3. you can use programs to implement software. I think you can think of software as a finished product, and programs are tools, just like woodcut knives are to wood carvings.
  4. your current questions are actually more focused on the basic principles of computer hardware. You can take a look at books like "how programs run." but it is recommended that you first lay a good foundation for js, so that it will be relatively easy to understand the principles of hardware with a higher degree of abstraction.
Menu