Note: A JavaScript Date object can only be instantiated by calling JavaScript Date as a constructor. Calling a regular function (that is, no new operator) will return a string instead of a Date object. Object has no text syntax
Note: When calling Date as a constructor with multiple parameters, adjacent values are adjusted if the value is greater than its logical range (for example, 13 is the month value, 70 is the minute value). For example. The new date (2013, 13, 1) is the same as the new date (2014, 1, 1). Both created dates of 2014-02-01 (note that the month is 0). Similarly, for other values, the new date (2013, 2, 1, 0, 70) is the same as the new date (2013, 2, 1, 1, 10). All of these will create a date of 2013-03-01T01: 10. 00
Note: When calling Date as a constructor with multiple parameters, the specified parameter represents local time. If UTC is required, use the same parameters to use the new date (Date.UTC (...)).
Note: Due to browser differences and inconsistencies, we strongly recommend not using the Date constructor (and equivalent Date.parse) to parse date strings.
From the initialization point of view, all native modules are handled the same way. For each module, an instance is created and a reference to that instance is stored in the Javascript native bridge. This allows you to call them later. In addition, references to the Bridge interface are passed to each native module, so you can call Javascript directly. Finally, two threads are created: JS Thread and NativeModulesThread *. As an interpreter script language, Javascript does not work as it is. It is necessary to convert it to bytecode before executing it. This is the function of Javascript virtual machine (aka Javascript engine). There are many Javascript engines including Chrome's V8, Mozilla's SpiderMonkey, Safari's JavaScriptCore, and so on. In debug mode, React Native runs directly in the browser using V8. Otherwise it defaults to JavaScriptCore and runs on the device.
Contrary to most beliefs, JavaScript compiles. The V8 engine improves performance by compiling JavaScript into native code before running native code, rather than bytecode execution and interpretation. What actually happens is that the engine is running multiple times through the code. One of them already declares all functions and variables, so it already exists at runtime. Through promotion, I have created a spiritual image of how to rearrange code before running even though the compilation process is much easier to explain.
Let's take a quick look at how JavaScript really works JavaScript runs on an engine called the JavaScript engine. The JavaScript engine is a program or interpreter that executes JavaScript code. The first JavaScript engine was created by Breda Eich of Netscape Communications Corporation for the Netscape Navigator web browser. The engine code SpiderMonkey is implemented in C ++. The Rhino engine, developed primarily by Norris Boyd (even Netscape), is a JavaScript implementation in Java. Applications for this technology include Nitro for Apple Safari 4, TraceMonkey for Google Chrome V8, and Mozilla Firefox 5.