Nodejs Getting Started

Source: Internet
Author: User

What is JavaScript
    • JavaScript is a dynamic type, a weak type, a prototype-based language.
    • JavaScript is a scripting language
      • Scripting languages are languages that do not need to be compiled in advance
      • is dynamically compiled and parsed at run time, so it is also called Dynamic language.
      • There is also a language called static languages (static languages need to be compiled before they can be executed), which is the difference between them.
    • JavaScript runs in the browser (here for the time being, and after the introduction of Nodejs you know that JavaScript is not just going to run on the browser
    • For the time being, JavaScript is a scripting language that runs in a browser.
JavaScript's operating environment
    • For beginners It may be assumed that the browser
    • In theory, JavaScript is the JavaScript parsing engine that runs in the browser, which is why Nodejs can run JavaScript later, which is described in more detail below.
What JavaScript in the browser can do
  • From the JavaScript language perspective: In fact, ECMAScript prescribes the core syntax of JavaScript scripts, such as data types, keywords, reserved words, operators, objects, and statements, which are not part of any browser.
    • ECMAScript 3 (currently used more in fact still at this level, because of the compatibility issues involved)
    • ECMAScript 5 (now the user is gradually increasing slowly)
    • ECMAScript 6 (Released in 2015, added a lot of more convenient specifications to make jascript more powerful)
  • DOM Operations
    • The DOM is the abbreviation for "Document Object Model", referred to as the "file Objects models", and the specification is developed by the
    • The DOM defines the interface for JavaScript to manipulate HTML documents, provides access to HTML documents (such as body, form, div, textarea, etc.) and how to do so, and after the browser loads the HTML document, it plans the entire document into a node tree of nodes. Each part of the document is a node
    • This is also the most widely used JavaScript, through the DOM operation allows the browser to render a variety of cool interface, and can complete a lot of business logic
  • BOM Operations
    • BOM is an abbreviation for "Browser object Model", referred to as "browser object models"
    • The BOM defines the interface of the JavaScript operation Browser, provides access to certain functions (such as browser window size, version information, browsing history, etc.) and how to do it, in fact, these interfaces are through the middle layer through the hardware level open to the programmer interface, And thanks to these interfaces, we can develop them efficiently.
    • Unfortunately, the BOM is only an extension of ECMAScript, there is no relevant standards, the company did not make the specification of the section, each browser vendors have their own BOM implementation, which can be said to be the weakness of the BOM, but also make many programs to feel very annoying a place-compatibility;
  • Ajax
    • Ajax is "Asynchronous JavaScript and XML" (Asynchronous JavaScript and XML), which is a web development technique for creating interactive Web applications
    • through the background and the server A small amount of data exchange, Ajax can make the Web page implementation of asynchronous update. This means that you can update a part of a webpage without reloading the entire page
    • speaking of which, Ajax saved JavaScript, because Javscript was often considered a very low-level scripting language before 2005, The most important thing is that many developers use it to develop some annoying ads and so on, eventually led to JavaScript in several major browsers are often disabled, I believe some developers now know that each browser has a disabled JavaScript option, but we do not really disable it , at most for debugging purposes, but then it is really disabled, well, unofficial history first said this .... 2005 for Ajax can be said to be an important one, a lot of important events to the public is really impressive, Google in its famous interactive application uses asynchronous communication, such as Google, Google Maps, Google search and so on. And Ajax is based on JavaScript, so this JavaScript has developed again.
  • Event-driven programming
    • The event drivers in JavaScript are triggered by the action of a mouse or hotkey, such as our common onclick (click), onchange (content Change), onfocus (get Focus), onblur (lost Focus), onload (document loading complete), Onselect (triggers the event when the contents of text or textarea are highlighted) ....
      There are many events here do not repeat, we just need to know is such an event-driven principle, so that we can achieve a lot of interaction, because we know that each user's behavior is very difficult to predict, so the computer can not be pre-fabricated to do something. The inside of the computer is only binary, that is, all of our operations will eventually be returned to the computer in binary (0101) Form, and then the computer is executed according to the instructions. In the early days there are many non-event-driven programs that, when waiting for a certain condition to trigger, constantly check the condition until the condition is met, which is a waste of CPU time. Event-driven programs have the opportunity to release the CPU to sleep (note that there is a chance, of course, the program can also decide not to release the CPU), when the event triggered by the operating system wake up, so that the CPU can be more efficient use
What JavaScript in the browser can not do
    • Compared to traditional C, Java, C #, C + + and so on these languages
      • File operations
        • Note: JavaScript itself is not an action file
        • For security
      • The client's JavaScript can send requests to the server, but cannot receive requests
The ability to program a language in the same way that developers are capable depends on what
    • The most important difference depends on your execution environment.
    • Compare some background languages: Java, PHP, C #, C + + run in a different environment
    • The ability of a programming language really depends on where the language is running (running environment)
Can JavaScript only run in the browser?
      • This can be inferred from the above problem, JavaScript is not only run in the browser, in fact, the key to determine the JavaScript is its operating environment, such as the V8 engine in Chrome, Firefox spidemonkey, IE's JScript , Safari's JavaScriptCore, Microsoftedge's Chakracore
      • These are actually engines, you can imagine the life of the engine, such as the engine in the car, but also can be said to be the engine of the car, I believe that the car knows that the engine can be replaced, that is, portable, and this is the most important characteristics of the engine;
      • The Nodejs author, by porting Chrome's V8 engine, makes JavaScript work across platforms, and it's a new era in JavaScript, and it's also making JavaScript a bit more advanced. And then we're going to go into the magical node world.

Nodejs Getting Started

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.