Câu hỏi phỏng vấn Javascript
Câu hỏi

What's the difference between Host objects and Native objects?

Câu trả lời

Host objects and Native objects are two categories of objects in JavaScript that serve different roles within the language and its environment.

Native Objects

Native objects, also known as built-in or standard objects, are provided by JavaScript itself. They are a fundamental part of the language and are available across all JavaScript environments, meaning they work the same way regardless of the machine or environment in which the code is running. Native objects include objects like Array, Date, Math, String, Number, and Object. They can be used as constructors (e.g., new String("Hello World")) or as primitive values (e.g., true, 999). These objects are standardized as part of the JavaScript language specification and cannot be modified. They are inheritable through prototypal inheritance and are consistently available and compatible across all JavaScript environments[1][2][3][4][5][6].

Host Objects

Host objects, on the other hand, are provided by the host environment in which JavaScript is running. This means they are environment-specific and can vary from one environment to another. For example, in a web browser environment, window, document, and XMLHttpRequest are host objects, while in a Node.js server environment, the process object is a host object. Host objects are not part of the JavaScript language itself but are necessary to complete the execution environment of ECMAScript. They may or may not be modifiable, inheritable, or standardized, and their availability and compatibility can differ based on the environment[1]...

junior

junior

Gợi ý câu hỏi phỏng vấn

middle

When should we use generators in ES6?

junior

Why would you use something like the load event? Does this event have disadvantages? Do you know
any alternatives, and why would you use those?

senior

How would you prevent Callback Hell without using promises, async or generators?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào