本文档提供了为 JavaScript Questions 仓库做贡献的指南和说明。该仓库收集了带有多项选择题答案和详细解释的 JavaScript 面试题,并提供多种语言版本。本指南涵盖了如何提交新问题、改进现有问题、创建翻译以及参与维护这个宝贵的教育资源。
有关如何将本仓库用于学习目的的信息,请参阅 学习路径。
来源: README.md6-12
The JavaScript Questions repository welcomes several types of contributions
Sources: README.md12-19 README.md22-50
When contributing new questions or improving existing ones, follow the specific format used throughout the repository to maintain consistency.
Each question follows this structure
###### [question number]. [question title]
```javascript
[code example]
[detailed explanation of the answer]
This format includes
Sources: README.md54-171
Translations are a crucial part of making the JavaScript questions accessible to a global audience. The repository already supports many languages, but new translations are always welcome.
To start a new translation
fr-FR for French)Use the ISO language code format for folder names
[language-code]-[COUNTRY-CODE] (e.g., es-ES for Spanish, zh-CN for Simplified Chinese)Ensure your translation includes
Sources: README.md22-50 nl-NL/README.md16-44 id-ID/README.md16-43
The following steps outline the process for contributing to the JavaScript Questions repository.
Sources: README.md16-18
When submitting a pull request, please follow these guidelines to ensure a smooth review process
When contributing new questions, consider focusing on these JavaScript concepts that the repository aims to cover comprehensively
| 类别 | 主题 |
|---|---|
| 变量与作用域 | Hoisting, Temporal Dead Zone, Block vs. Global Scope, var vs. let vs. const |
| 函数 | Arrow Functions, Regular Functions, this Context, Closures, IIFEs, Generators |
| 对象与原型 | Object Creation, Prototype Chain, Constructor Functions, Classes, Property Access |
| Asynchronous JS | Event Loop, Promises, async/await, setTimeout/setInterval, Callbacks |
| Data Types & Coercion | Primitive Types, Reference Types, Type Conversion, Truthy & Falsy Values, Operators |
| ES6+ 特性 | Destructuring, Spread Operator, Rest Parameters, Template Literals, Modules |
| DOM 与事件 | Event Propagation, Event Bubbling, Event Delegation, DOM Manipulation |
Sources: README.md63-147 README.md451-468
When contributing to the JavaScript Questions repository, please adhere to these principles
Contributors to the repository are valued members of the community. Your contributions help make JavaScript concepts more accessible to developers worldwide. The project author (Lydia Hallie) appreciates all contributors who help maintain and improve the repository.
Sources: README.md12-18
Here's an example of how a question should be formatted
###### X. What's the output?
```javascript
function sayHi() {
console.log(name);
console.log(age);
var name = 'Lydia';
let age = 21;
}
sayHi();
Lydia and undefinedLydia and ReferenceErrorReferenceError and 21undefined and ReferenceError
Within the function, we first declare the name variable with the var keyword. This means that the variable gets hoisted (memory space is set up during the creation phase) with the default value of undefined, until we actually get to the line where we define the variable. We haven't defined the variable yet on the line where we try to log the name variable, so it still holds the value of undefined.
Variables with the let keyword (and const) are hoisted, but unlike var, don't get initialized. They are not accessible before the line we declare (initialize) them. This is called the "temporal dead zone". When we try to access the variables before they are declared, JavaScript throws a ReferenceError.
Sources: README.md54-82
To better understand JavaScript concepts and improve your contributions, consider these resources
By following these guidelines, you'll help maintain the high quality of the JavaScript Questions repository and contribute to making JavaScript knowledge more accessible to developers around the world.
刷新此 Wiki
最后索引时间2025 年 4 月 18 日(a8b427)