diff --git a/README.md b/README.md
index dc0abf56e..b37c43773 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,5 @@
+*[简体中文](Translations/Chinese/README.md)*
+
diff --git a/Translations/Chinese/questions/css-questions.md b/Translations/Chinese/questions/css-questions.md
index 265fa9a19..b52662de7 100644
--- a/Translations/Chinese/questions/css-questions.md
+++ b/Translations/Chinese/questions/css-questions.md
@@ -1,6 +1,6 @@
# CSS 问题
-本章节是[前端开发者面试问题- CSS 部分](https://github.com/h5bp/Front-end-Developer-Interview-Questions/blob/master/questions/css-questions.md)的参考答案。 欢迎提出 PR 进行建议和指正!
+本章节是[前端开发者面试问题 - CSS 部分](https://github.com/h5bp/Front-end-Developer-Interview-Questions/blob/master/questions/css-questions.md)的参考答案。 欢迎提出 PR 进行建议和指正!
* [CSS 选择器的优先级是如何计算的?](#css-选择器的优先级是如何计算的)
* [重置(resetting)CSS 和 标准化(normalizing)CSS 的区别是什么?你会选择哪种方式,为什么?](#重置resettingcss-和-标准化normalizingcss-的区别是什么你会选择哪种方式为什么)
diff --git a/Translations/Chinese/questions/html-questions.md b/Translations/Chinese/questions/html-questions.md
index 983dc7aec..3ae2e403b 100644
--- a/Translations/Chinese/questions/html-questions.md
+++ b/Translations/Chinese/questions/html-questions.md
@@ -1,6 +1,6 @@
# HTML 问题
-本章节是[前端开发者面试问题- HTML 部分](https://github.com/h5bp/Front-end-Developer-Interview-Questions#html-questions)的参考答案。 欢迎提出 PR 进行建议和指正!
+本章节是[前端开发者面试问题 - HTML 部分](https://github.com/h5bp/Front-end-Developer-Interview-Questions#html-questions)的参考答案。 欢迎提出 PR 进行建议和指正!
* [`DOCTYPE`有什么用?](#doctype有什么用)
* [如何提供包含多种语言内容的页面?](#如何提供包含多种语言内容的页面)
diff --git a/Translations/Chinese/questions/javascript-questions.md b/Translations/Chinese/questions/javascript-questions.md
index 60c586365..51b61af46 100644
--- a/Translations/Chinese/questions/javascript-questions.md
+++ b/Translations/Chinese/questions/javascript-questions.md
@@ -1,151 +1,148 @@
-## JS Questions
-
-Answers to [Front-end Job Interview Questions - JS Questions](https://github.com/h5bp/Front-end-Developer-Interview-Questions/blob/master/questions/javascript-questions.md). Pull requests for suggestions and corrections are welcome!
-
-* [Explain event delegation](#explain-event-delegation)
-* [简述 `JavaScript` 中的 `this`](#explain-how-this-works-in-javascript)
-* [Explain how prototypal inheritance works](#explain-how-prototypal-inheritance-works)
-* [What do you think of AMD vs CommonJS?](#what-do-you-think-of-amd-vs-commonjs)
-* [Explain why the following doesn't work as an IIFE: `function foo(){ }();`. What needs to be changed to properly make it an IIFE?](#explain-why-the-following-doesnt-work-as-an-iife-function-foo--what-needs-to-be-changed-to-properly-make-it-an-iife)
-* [`null`, `undefined` 和未定义的变量有什么区别? 如何区分?](#whats-the-difference-between-a-variable-that-is-null-undefined-or-undeclared-how-would-you-go-about-checking-for-any-of-these-states)
-* [What is a closure, and how/why would you use one?](#what-is-a-closure-and-howwhy-would-you-use-one)
-* [Can you describe the main difference between a `.forEach` loop and a `.map()` loop and why you would pick one versus the other?](#can-you-describe-the-main-difference-between-a-foreach-loop-and-a-map-loop-and-why-you-would-pick-one-versus-the-other)
-* [匿名函数有哪些使用场景?](#whats-a-typical-use-case-for-anonymous-functions)
-* [How do you organize your code? (module pattern, classical inheritance?)](#how-do-you-organize-your-code-module-pattern-classical-inheritance)
-* [宿主对象(host objects)和本地对象(native objects)有什么区别?](#whats-the-difference-between-host-objects-and-native-objects)
-* [Difference between: function `Person(){}`, `var person = Person()`, and `var person = new Person()`?](#difference-between-function-person-var-person--person-and-var-person--new-person)
-* [What's the difference between `.call` and `.apply`?](#whats-the-difference-between-call-and-apply)
-* [Explain `Function.prototype.bind`.](#explain-functionprototypebind)
-* [什么时候会用到 `document.write()`?](#when-would-you-use-documentwrite)
-* [What's the difference between feature detection, feature inference, and using the UA string?](#whats-the-difference-between-feature-detection-feature-inference-and-using-the-ua-string)
-* [Explain Ajax in as much detail as possible.](#explain-ajax-in-as-much-detail-as-possible)
-* [`ajax` 技术有哪些优点和缺点?](#what-are-the-advantages-and-disadvantages-of-using-ajax)
-* [Explain how JSONP works (and how it's not really Ajax).](#explain-how-jsonp-works-and-how-its-not-really-ajax)
-* [Have you ever used JavaScript templating? If so, what libraries have you used?](#have-you-ever-used-javascript-templating-if-so-what-libraries-have-you-used)
-* [解释下变量提升(`hoisting`)](#explain-hoisting)
-* [Describe event bubbling.](#describe-event-bubbling)
-* [What's the difference between an "attribute" and a "property"?](#whats-the-difference-between-an-attribute-and-a-property)
-* [Why is extending built-in JavaScript objects not a good idea?](#why-is-extending-built-in-javascript-objects-not-a-good-idea)
-* [Difference between document `load` event and document `DOMContentLoaded` event?](#difference-between-document-load-event-and-document-domcontentloaded-event)
-* [What is the difference between `==` and `===`?](#what-is-the-difference-between--and-)
-* [Explain the same-origin policy with regards to JavaScript.](#explain-the-same-origin-policy-with-regards-to-javascript)
-* [Make this work: `duplicate([1,2,3,4,5]); // [1,2,3,4,5,1,2,3,4,5]`](#make-this-work)
-* [Why is it called a Ternary expression, what does the word "Ternary" indicate?](#why-is-it-called-a-ternary-expression-what-does-the-word-ternary-indicate)
-* [What is "use strict";? what are the advantages and disadvantages to using it?](#what-is-use-strict-what-are-the-advantages-and-disadvantages-to-using-it)
-* [Create a for loop that iterates up to 100 while outputting "fizz" at multiples of 3, "buzz" at multiples of 5 and "fizzbuzz" at multiples of 3 and 5](#create-a-for-loop-that-iterates-up-to-100-while-outputting-fizz-at-multiples-of-3-buzz-at-multiples-of-5-and-fizzbuzz-at-multiples-of-3-and-5)
-* [Why is it, in general, a good idea to leave the global scope of a website as-is and never touch it?](#why-is-it-in-general-a-good-idea-to-leave-the-global-scope-of-a-website-as-is-and-never-touch-it)
-* [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?](#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)
-* [Explain what a single page app is and how to make one SEO-friendly.](#explain-what-a-single-page-app-is-and-how-to-make-one-seo-friendly)
-* [What is the extent of your experience with Promises and/or their polyfills?](#what-is-the-extent-of-your-experience-with-promises-andor-their-polyfills)
-* [What are the pros and cons of using Promises instead of callbacks?](#what-are-the-pros-and-cons-of-using-promises-instead-of-callbacks)
-* [What are some of the advantages/disadvantages of writing JavaScript code in a language that compiles to JavaScript?](#what-are-some-of-the-advantagesdisadvantages-of-writing-javascript-code-in-a-language-that-compiles-to-javascript)
-* [What tools and techniques do you use debugging JavaScript code?](#what-tools-and-techniques-do-you-use-for-debugging-javascript-code)
-* [What language constructions do you use for iterating over object properties and array items?](#what-language-constructions-do-you-use-for-iterating-over-object-properties-and-array-items)
-* [Explain the difference between mutable and immutable objects.](#explain-the-difference-between-mutable-and-immutable-objects)
-* [Explain the difference between synchronous and asynchronous functions.](#explain-the-difference-between-synchronous-and-asynchronous-functions)
-* [What is event loop? What is the difference between call stack and task queue?](#what-is-event-loop-what-is-the-difference-between-call-stack-and-task-queue)
-* [Explain the differences on the usage of `foo` between `function foo() {}` and `var foo = function() {}`](#explain-the-differences-on-the-usage-of-foo-between-function-foo--and-var-foo--function-)
-* [What are the differences between variables created using `let`, `var` or `const`?](#what-are-the-differences-between-variables-created-using-let-var-or-const)
-* [What are the differences between ES6 class and ES5 function constructors?](#what-are-the-differences-between-es6-class-and-es5-function-constructors)
-* [Can you offer a use case for the new arrow => function syntax? How does this new syntax differ from other functions?](#can-you-offer-a-use-case-for-the-new-arrow--function-syntax-how-does-this-new-syntax-differ-from-other-functions)
-* [What advantage is there for using the arrow syntax for a method in a constructor?](#what-advantage-is-there-for-using-the-arrow-syntax-for-a-method-in-a-constructor)
-* [What is the definition of a higher-order function?](#what-is-the-definition-of-a-higher-order-function)
-* [Can you give an example for destructuring an object or an array?](#can-you-give-an-example-for-destructuring-an-object-or-an-array)
-* [ES6 Template Literals offer a lot of flexibility in generating strings, can you give an example?](#es6-template-literals-offer-a-lot-of-flexibility-in-generating-strings-can-you-give-an-example)
-* [Can you give an example of a curry function and why this syntax offers an advantage?](#can-you-give-an-example-of-a-curry-function-and-why-this-syntax-offers-an-advantage)
-* [What are the benefits of using spread syntax and how is it different from rest syntax?](#what-are-the-benefits-of-using-spread-syntax-and-how-is-it-different-from-rest-syntax)
-* [How can you share code between files?](#how-can-you-share-code-between-files)
-* [Why you might want to create static class members?](#why-you-might-want-to-create-static-class-members)
-
-### Explain event delegation
-
-Event delegation is a technique involving adding event listeners to a parent element instead of adding them to the descendant elements. The listener will fire whenever the event is triggered on the descendant elements due to event bubbling up the DOM. The benefits of this technique are:
-
-* Memory footprint goes down because only one single handler is needed on the parent element, rather than having to attach event handlers on each descendant.
-* There is no need to unbind the handler from elements that are removed and to bind the event for new elements.
-
-###### References
+## JS 问题
+
+本章节是[前端开发者面试问题 - JS 部分](https://github.com/h5bp/Front-end-Developer-Interview-Questions/blob/master/questions/javascript-questions.md)的参考答案。 欢迎提出 PR 进行建议和指正!
+
+* [请解释事件委托(event delegation)。](#请解释事件委托event-delegation)
+* [请简述`JavaScript`中的`this`。](#请简述javascript中的this)
+* [请解释原型继承(prototypal inheritance)的工作原理。](#请解释原型继承prototypal-inheritance的工作原理)
+* [说说你对 AMD 和 CommonJS 的了解。](#说说你对-amd-和-commonjs-的了解)
+* [请解释下面代码为什么不能用作 IIFE:`function foo(){ }();` 需要作出哪些修改才能使其成为 IIFE?](#请解释下面代码为什么不能用作-iifefunction-foo--需要作出哪些修改才能使其成为-iife)
+* [`null`、`undefined`和未声明变量之间有什么区别?如何检查这些状态值?](#nullundefined和未声明变量之间有什么区别如何检查这些状态值)
+* [什么是闭包(closure),以及为什么使用闭包?](#什么是闭包closure以及为什么使用闭包)
+* [请说明`.forEach`循环和`.map()`循环的主要区别,以及分别何时使用?](#请说明foreach循环和map循环的主要区别以及分别何时使用)
+* [匿名函数的典型应用场景是什么?](#匿名函数的典型应用场景是什么)
+* [你如何组织自己的代码?(使用模块模式(module pattern)还是经典继承(classical inheritance)?)](#你如何组织自己的代码使用模块模式module-pattern还是经典继承classical-inheritance)
+* [宿主对象(host objects)和原生对象(native objects)的区别是什么?](#宿主对象host-objects和原生对象native-objects的区别是什么)
+* [下列语句有何区别:`function Person(){}`、`var person = Person()`和`var person = new Person()`?](#下列语句有何区别function-personvar-person--person和var-person--new-person)
+* [`.call`和`.apply`有什么区别?](#call和apply有什么区别)
+* [请说明`Function.prototype.bind`的用法。](#请说明functionprototypebind的用法)
+* [什么时候会用到document.write()`?](#什么时候会用到documentwrite)
+* [功能检测(feature detection)、功能推断(feature inference)和使用 UA 字符串之间有什么区别?](#功能检测feature-detection功能推断feature-inference和使用-ua-字符串之间有什么区别)
+* [请尽可能详细地解释 Ajax。](#请尽可能详细地解释-ajax)
+* [使用Ajax的优缺点分别是什么?](#使用ajax的优缺点分别是什么)
+* [请说明 JSONP 的工作原理,以及它为什么不是真正的 Ajax?](#请说明-jsonp-的工作原理以及它为什么不是真正的-ajax)
+* [你使用过 JavaScript 模板吗?用过什么相关的库?](#你使用过-javascript-模板吗用过什么相关的库)
+* [请解释变量提升(hosting)。](#请解释变量提升hosting)
+* [请描述事件冒泡。](#请描述事件冒泡)
+* [“attribute” 和 “property” 之间有什么区别?](#attribute-和-property-之间有什么区别)
+* [为什么扩展 JavaScript 内置对象是不好的做法?](#为什么扩展-javascript-内置对象是不好的做法)
+* [document 中的`load`事件和`DOMContentLoaded`事件之间的区别是什么?](#document-中的load事件和domcontentloaded事件之间的区别是什么)
+* [`==`和`===`的区别是什么?](#和的区别是什么)
+* [请解释关于JavaScript的同源策略。](#请解释关于javascript的同源策略)
+* [请使下面的语句生效:](#请使下面的语句生效)
+* [请说明三元表达式中“三元”这个词代表什么?](#请说明三元表达式中三元这个词代表什么)
+* [什么是`"use strict";`?使用它有什么优缺点?](#什么是use-strict使用它有什么优缺点)
+* [创建一个循环,从1迭代到100,`3`的倍数时输出**"fizz"**,`5`的倍数时输出**"buzz"**,同时为`3`和`5`的倍数时输出**"fizzbuzz"**。](#创建一个循环从1迭代到1003的倍数时输出fizz5的倍数时输出buzz同时为3和5的倍数时输出fizzbuzz)
+* [为什么不要使用全局作用域?](#为什么不要使用全局作用域)
+* [为什么要使用`load`事件?这个事件有什么缺点吗?你知道一些代替方案吗,为什么使用它们?](#为什么要使用load事件这个事件有什么缺点吗你知道一些代替方案吗为什么使用它们)
+* [请解释单页应用是什么以及如何使其对SEO友好。](#请解释单页应用是什么以及如何使其对seo友好)
+* [你对 Promises 及其 polyfill 的掌握程度如何?](#你对-promises-及其-polyfill-的掌握程度如何)
+* [`Promise`代替回调函数有什么优缺点?](#promise代替回调函数有什么优缺点)
+* [用转译成 JavaScript 的语言写 JavaScript 有什么优缺点?](#用转译成-javascript-的语言写-javascript-有什么优缺点)
+* [你使用什么工具和技巧调试 JavaScript 代码?](#你使用什么工具和技巧调试-javascript-代码)
+* [你使用什么语句遍历对象的属性和数组的元素?](#你使用什么语句遍历对象的属性和数组的元素)
+* [请解释可变对象和不可变对象之间的区别。](#请解释可变对象和不可变对象之间的区别)
+* [请解释同步和异步函数之间的区别。](#请解释同步和异步函数之间的区别)
+* [什么是事件循环?调用堆栈和任务队列之间有什么区别?](#什么是事件循环调用堆栈和任务队列之间有什么区别)
+* [请解释`function foo() {}`和`var foo = function() {}`之间`foo`的用法上的区别。](#请解释function-foo-和var-foo--function-之间foo的用法上的区别)
+* [使用`let`、`var`和`const`创建变量有什么区别?](#使用letvar和const创建变量有什么区别)
+* [ES6 的类和 ES5 的构造函数有什么区别?](#es6-的类和-es5-的构造函数有什么区别)
+* [你能给出一个使用箭头函数的例子吗,箭头函数与其他函数有什么不同?](#你能给出一个使用箭头函数的例子吗箭头函数与其他函数有什么不同)
+* [在构造函数中使用箭头函数有什么好处?](#在构造函数中使用箭头函数有什么好处)
+* [高阶函数(higher-order)的定义是什么?](#高阶函数higher-order的定义是什么)
+* [请给出一个解构(destructuring)对象或数组的例子。](#请给出一个解构destructuring对象或数组的例子)
+* [ES6 的模板字符串为生成字符串提供了很大的灵活性,你可以举个例子吗?](#es6-的模板字符串为生成字符串提供了很大的灵活性你可以举个例子吗)
+* [你能举出一个柯里化函数(curry function)的例子吗?它有哪些好处?](#你能举出一个柯里化函数curry-function的例子吗它有哪些好处)
+* [使用扩展运算符(spread)的好处是什么,它与使用剩余参数语句(rest)有什么区别?](#使用扩展运算符spread的好处是什么它与使用剩余参数语句rest有什么区别)
+* [如何在文件之间共用代码?](#如何在文件之间共用代码)
+* [为什么你可能想创建静态类成员?](#为什么你可能想创建静态类成员)
+
+### 请解释事件委托(event delegation)。
+
+事件委托是将事件监听器添加到父元素,而不是每个子元素单独设置事件监听器。当触发子元素时,事件会冒泡到父元素,监听器就会触发。 这种技术的好处是:
+
+* 内存占用减少,因为父元素只需要一个事件处理程序,而不必为每个后代都添加事件处理程序。
+* 无需从已删除的元素中解除绑定处理程序,也无需将处理程序绑定到新元素上。
+
+###### 参考
* https://davidwalsh.name/event-delegate
* https://stackoverflow.com/questions/1687296/what-is-dom-event-delegation
-[[↑] Back to top](#js-questions)
+[[↑] 回到顶部](#js-问题)
-
+### 请简述`JavaScript`中的`this`。
-### 简述 `JavaScript` 中的 `this`
+JS 中的`this`是一个相对复杂的概念,不是简单几句能解释清楚的。粗略地讲,函数的调用方式决定了`this`的值。我阅读了网上很多关于`this`的文章,[Arnav Aggrawal](https://medium.com/@arnav_aggarwal) 写的比较清楚。`this`取值符合以下规则:
-JS 中的 `this` 是一个相对复杂的概念, 不是简单几句能解释清楚的。比较不负责任的说法是 `this` 的值取决于函数是如何调用的。我阅读了网上很多关于 `this` 的文章, [Arnav Aggrawal](https://medium.com/@arnav_aggarwal) 写的比较清楚. `this` 取值符合以下规则:
+1. 在调用函数时使用`new`关键字,函数内的`this`是一个全新的对象。
+1. 如果`apply`、`call`或`bind`方法用于调用、创建一个函数,函数内的this就是作为参数传入这些方法的对象。
+1. 当函数作为对象里的方法被调用时,函数内的`this`是调用该函数的对象。比如当`obj.method()`被调用时,函数内的this将绑定到`obj`对象。
+1. 如果调用函数不符合上述规则,那么`this`的值指向全局对象(global object)。浏览器环境下`this`的值指向`window`对象,但是在严格模式下(`'use strict'`),`this`的值为`undefined`。
+1. 如果符合上述多个规则,则较高的规则(1号最高,4号最低)将决定`this`的值。
+1. 如果该函数是 ES2015 中的箭头函数,将忽略上面的所有规则,`this`被设置为它被创建时的上下文。
-1. 通过 `new` 关键字调用函数, `this` 会是一个全新的 `object`
-2. 使用 `apply`, `call` 或者 `bind` 来调用/创建函数, `this` 的值取决于传入的第一个参数
-3. 如果函数作为对象的方法被调用, 比如 `obj.method()`, `this` 的值为该函数所作为属性的 `object`, 比如 `obj`
-4. 如果函数调用时不满足上述条件, 也就是 `free function`, `this` 的值为全局对象. 浏览器环境下是 `window` 对象, 但是在严格模式下(`'use strict'`), `this` 的值为 `undefined`
-5. ES2015(ES6) 提出的箭头函数(Arrow function)不符合上述规则, 箭头函数 `this` 的值是该函数被 `创建时` 的作用域
+想获取更深入的解释,请查看[他在 Medium 上的文章](https://codeburst.io/the-simple-rules-to-this-in-javascript-35d97f31bde3)。
-更深入的解释可以去查看[他在 Medium 上的文章](https://codeburst.io/the-simple-rules-to-this-in-javascript-35d97f31bde3)
-
-###### References
+###### 参考
* https://codeburst.io/the-simple-rules-to-this-in-javascript-35d97f31bde3
* https://stackoverflow.com/a/3127440/1751946
-[[↑] Back to top](#js-questions)
+[[↑] 回到顶部](#js-问题)
-### Explain how prototypal inheritance works
+### 请解释原型继承(prototypal inheritance)的工作原理。
-This is an extremely common JavaScript interview question. All JavaScript objects have a `prototype` property, that is a reference to another object. When a property is accessed on an object and if the property is not found on that object, the JavaScript engine looks at the object's `prototype`, and the `prototype`'s `prototype` and so on, until it finds the property defined on one of the `prototype`s or until it reaches the end of the prototype chain. This behaviour simulates classical inheritance, but it is really more of [delegation than inheritance](https://davidwalsh.name/javascript-objects).
+这是一个非常常见的 JavaScript 问题。所有 JS 对象都有一个`prototype`属性,指向它的原型对象。当试图访问一个对象的属性时,如果没有在该对象上找到,它还会搜寻该对象的原型,以及该对象的原型的原型,依次层层向上搜索,直到找到一个名字匹配的属性或到达原型链的末尾。这种行为是在模拟经典的继承,[但是与其说是继承,不如说是委托(delegation)](https://davidwalsh.name/javascript-objects)。
-###### References
+###### 参考
* https://www.quora.com/What-is-prototypal-inheritance/answer/Kyle-Simpson
* https://davidwalsh.name/javascript-objects
-[[↑] Back to top](#js-questions)
+[[↑] 回到顶部](#js-问题)
-### What do you think of AMD vs CommonJS?
+### 说说你对 AMD 和 CommonJS 的了解。
-Both are ways to implement a module system, which was not natively present in JavaScript until ES2015 came along. CommonJS is synchronous while AMD (Asynchronous Module Definition) is obviously asynchronous. CommonJS is designed with server-side development in mind while AMD, with its support for asynchronous loading of modules, is more intended for browsers.
+它们都是实现模块体系的方式,直到 ES2015 出现之前,JavaScript 一直没有模块体系。CommonJS 是同步的,而 AMD(Asynchronous Module Definition)明显从全称中可以看出是异步的。CommonJS 的设计是为服务器端开发考虑的,而 AMD 支持异步加载模块,更适合浏览器。
-I find AMD syntax to be quite verbose and CommonJS is closer to the style you would write import statements in other languages. Most of the time, I find AMD unnecessary, because if you served all your JavaScript into one concatenated bundle file, you wouldn't benefit from the async loading properties. Also, CommonJS syntax is closer to Node style of writing modules and there is less context-switching overhead when switching between client side and server side JavaScript development.
+我发现 AMD 的语法非常冗长,CommonJS 更接近其他语言 import 声明语句的用法习惯。大多数情况下,我认为 AMD 没有使用的必要,因为如果把所有 JavaScript 都捆绑进一个文件中,将无法得到异步加载的好处。此外,CommonJS 语法上更接近 Node 编写模块的风格,在前后端都使用 JavaScript 开发之间进行切换时,语境的切换开销较小。
-I'm glad that with ES2015 modules, that has support for both synchronous and asynchronous loading, we can finally just stick to one approach. Although it hasn't been fully rolled out in browsers and in Node, we can always use transpilers to convert our code.
+我很高兴看到 ES2015 的模块加载方案同时支持同步和异步,我们终于可以只使用一种方案了。虽然它尚未在浏览器和 Node 中完全推出,但是我们可以使用代码转换器进行转换。
-###### References
+###### 参考
* https://auth0.com/blog/javascript-module-systems-showdown/
* https://stackoverflow.com/questions/16521471/relation-between-commonjs-amd-and-requirejs
-[[↑] Back to top](#js-questions)
+[[↑] 回到顶部](#js-问题)
-### Explain why the following doesn't work as an IIFE: `function foo(){ }();`. What needs to be changed to properly make it an IIFE?
+### 请解释下面代码为什么不能用作 IIFE:`function foo(){ }();` 需要作出哪些修改才能使其成为 IIFE?
-IIFE stands for Immediately Invoked Function Expressions. The JavaScript parser reads `function foo(){ }();` as `function foo(){ }` and `();`, where the former is a function declaration and the latter (a pair of brackets) is an attempt at calling a function but there is no name specified, hence it throws `Uncaught SyntaxError: Unexpected token )`.
+IIFE(Immediately Invoked Function Expressions)代表立即执行函数。 JavaScript 解析器将 `function foo(){ }();`解析成`function foo(){ }`和`();`。其中,前者是函数声明;后者(一对括号)是试图调用一个函数时,没有指定名称,因此它会抛出`Uncaught SyntaxError: Unexpected token )`的错误。
-Here are two ways to fix it that involves adding more brackets: `(function foo(){ })()` and `(function foo(){ }())`. These functions are not exposed in the global scope and you can even omit its name if you do not need to reference itself within the body.
+修改方法是再添加一对括号,形式上有两种:`(function foo(){ })()`和`(function foo(){ }())`。以上函数不会暴露到全局作用域,如果不需要在函数内部引用自身,可以省略函数的名称。
-###### References
+###### 参考
* http://lucybain.com/blog/2014/immediately-invoked-function-expression/
-[[↑] Back to top](#js-questions)
-
-
+[[↑] 回到顶部](#js-问题)
-### `null`, `undefined` 和未定义的变量有什么区别? 如何区分?
+### `null`、`undefined`和未声明变量之间有什么区别?如何检查这些状态值?
-当你先前没有使用 `var`, `let` 或 `const` 创建一个变量, 就直接给这个标识符(identifier, 或者说变量名?)赋值时, 你就会创建一个**未定义(Undeclared)**变量. 未定义变量不会存在于当前作用域, 而是默认定义在全局作用域(globally scope). 严格模式下, 你给一个未定义变量赋值时会抛出 `ReferenceError` 错误. 使用未定义变量不是好习惯, 这跟尽量不使用全局变量是一个道理, 应最大化的避免. 将代码包裹在 `try`/`catch` 中能帮你检查出未定义变量.
+当你先前没有使用`var`、`let`或`const`声明变量,就为一个变量赋值时,该变量是未声明变量(undeclared variables)。未声明变量会脱离当前作用域,成为全局作用域下定义的变量。在严格模式下,给未声明的变量赋值,会抛出`ReferenceError`错误。和使用全局变量一样,使用未声明变量也是非常不好的做法,应当尽可能避免。要检查它们,需要将用到它们的代码放在`try`/`catch`语句中。
```js
function foo() {
- x = 1; // Throws a ReferenceError in strict mode
+ x = 1; // 在严格模式下,抛出 ReferenceError 错误
}
foo();
console.log(x); // 1
```
-`undefined` 指的是你定义了变量, 但没有赋值. 这个变量的类型就是 `undefined`。如果函数没写返回值, 默认也会是 `undefined`. 检查变量是不是 `undefined` 需要用到严格等于(`===`)操作符或 `typeof`(`foo === undefined` or `typeof foo === 'undefined'`)。需要注意的是你不能用抽象相等操作符(`==`)来判断, 因为 `null` 值也会返回 `true`(`null == undefined`)。
+当一个变量已经声明,但没有赋值时,该变量的值及其类型是`undefined`。如果一个函数的执行结果被赋值给一个变量,但是这个函数却没有返回任何值,那么该变量的值是`undefined`。要检查它,需要使用严格相等(`===`);或者使用`typeof`,它会返回`'undefined'`字符串。请注意,不能使用非严格相等(`==`)来检查,因为如果变量值为`null`,使用非严格相等也会返回`true`。
```js
var foo;
@@ -153,63 +150,61 @@ console.log(foo); // undefined
console.log(foo === undefined); // true
console.log(typeof foo === 'undefined'); // true
-console.log(foo == null); // true. Wrong, don't use this to check!
+console.log(foo == null); // true. 错误,不要使用非严格相等!
function bar() {}
var baz = bar();
console.log(baz); // undefined
```
-`null` 值只能是被显式赋值给变量。它代表`无意义`或是`空值`, 并且和被显式赋值 `undefined` 的变量意义不同。检查 `null` 值需要使用严格相等运算符。
+`null`值只能是被显式赋值给变。它表示`空值`,与被显式赋值 `undefined` 的变量意义不同。要检查`null`,需要使用严格相等运算符进行比较。请注意,和上面一样,不能使用非严格相等(`==`)来检查,因为如果变量值为`undefined`,使用非严格相等也会返回`true`。
```js
var foo = null;
console.log(foo === null); // true
-console.log(foo == undefined); // true. Wrong, don't use this to check!
+console.log(foo == undefined); // true. 错误,不要使用非严格相等!
```
-作为一个好习惯, 你应该避免使用未定义或为未声明(undeclared or unassigned)的变量。如果定义了暂时没有用到的变量,我会在声明后明确地给它们赋值为 `null`。
-
-> 译者注: 这部分应借助一些工具比如代码检查 `eslint`, 静态类型检查: `flow`, `typescript`, 而不是刀耕火种
+作为一种个人习惯,我从不使用未声明变量。如果定义了暂时没有用到的变量,我会在声明后明确地给它们赋值为`null`。
-###### References
+###### 参考
* https://stackoverflow.com/questions/15985875/effect-of-declared-and-undeclared-variables
* https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/undefined
-[[↑] Back to top](#js-questions)
+[[↑] 回到顶部](#js-问题)
-### What is a closure, and how/why would you use one?
+### 什么是闭包(closure),以及为什么使用闭包?
-A closure is the combination of a function and the lexical environment within which that function was declared. The word "lexical" refers to the fact that lexical scoping uses the location where a variable is declared within the source code to determine where that variable is available. Closures are functions that have access to the outer (enclosing) function's variables—scope chain even after the outer function has returned.
+闭包是函数和声明该函数的词法环境的组合。词法作用域中使用的域,是变量在代码中声明的位置所决定的。闭包是即使被外部函数返回,依然可以访问到外部(封闭)函数作用域的函数。
-**Why would you use one?**
+为什么使用闭包?
-* Data privacy / emulating private methods with closures. Commonly used in the [module pattern](https://addyosmani.com/resources/essentialjsdesignpatterns/book/#modulepatternjavascript).
-* [Partial applications or currying](https://medium.com/javascript-scene/curry-or-partial-application-8150044c78b8#.l4b6l1i3x).
+* 利用闭包实现数据私有化或模拟私有方法。这个方式也称为[模块模式(module pattern)](https://addyosmani.com/resources/essentialjsdesignpatterns/book/#modulepatternjavascript)。
+* [部分参数函数(partial applications)柯里化(currying)](https://medium.com/javascript-scene/curry-or-partial-application-8150044c78b8#.l4b6l1i3x).
-###### References
+###### 参考
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Closures
* https://medium.com/javascript-scene/master-the-javascript-interview-what-is-a-closure-b2f0d2152b36
-[[↑] Back to top](#js-questions)
+[[↑] 回到顶部](#js-问题)
-### Can you describe the main difference between a `.forEach` loop and a `.map()` loop and why you would pick one versus the other?
+### 请说明`.forEach`循环和`.map()`循环的主要区别,以及分别何时使用?
-To understand the differences between the two, let's look at what each function does.
+为了理解两者的区别,我们看看它们分别是做什么的。
**`forEach`**
-* Iterates through the elements in an array.
-* Executes a callback for each element.
-* Does not return a value.
+* 遍历数组中的元素。
+* 为每个元素执行回调。
+* 无返回值。
```js
const a = [1, 2, 3];
const doubled = a.forEach((num, index) => {
- // Do something with num and/or index.
+ // 执行与 num、index 相关的代码
});
// doubled = undefined
@@ -217,8 +212,8 @@ const doubled = a.forEach((num, index) => {
**`map`**
-* Iterates through the elements in an array.
-* "Maps" each element to a new element by calling the function on each element, creating a new array as a result.
+* 遍历数组中的元素
+* 通过对每个元素调用函数,将每个元素“映射(map)”到一个新元素,从而创建一个新数组。
```js
const a = [1, 2, 3];
@@ -229,28 +224,25 @@ const doubled = a.map(num => {
// doubled = [2, 4, 6]
```
-The main difference between `.forEach` and `.map()` is that `.map()` returns a new array. If you need the result, but do not wish to mutate the original array, `.map()` is the clear choice. If you simply need to iterate over an array, `forEach` is a fine choice.
+`.forEach`和`.map()`的主要区别在于`.map()`返回一个新的数组。如果你想得到一个结果,但不想改变原始数组,用`.map()`。如果你只需要在数组上做迭代修改,用`forEach`。
-###### References
+###### 参考
* https://codeburst.io/javascript-map-vs-foreach-f38111822c0f
-[[↑] Back to top](#js-questions)
+[[↑] 回到顶部](#js-问题)
-
+### 匿名函数的典型应用场景是什么?
-### 匿名函数有哪些使用场景?
-
-它们可以用于立即执行函数(`IIFE`), 将代码密封到局部作用域, 使得其中声明的变量不会污染全局作用域。
+匿名函数可以在IIFE中使用,来封装局部作用域内的代码,以便其声明的变量不会暴露到全局作用域。
```js
(function() {
- // Some code here.
+ // 一些代码。
})();
```
-作为一次使用的回调,不需要在其他地方使用。当处理程序在调用它们的代码内部进行定义时,代码看起来更具自包含性和可读性,而不必在别处搜索以查找函数体。
-作为一次性回调函数使用, 并且没有其他地方引用时, 建议用匿名函数。这使得代码更具有自包含性和可读性(`self-contained and readable`)。
+匿名函数可以作为只使用一次,而不需要在其他地方使用的回调函数。当处理函数在调用它们的程序内部被定义时,代码具有更好地自闭性和可读性,可以省去寻找该处理函数的函数体位置的麻烦。
```js
setTimeout(function() {
@@ -258,7 +250,7 @@ setTimeout(function() {
}, 1000);
```
-匿名函数也可以用于函数式编程结构的参数, 或 Lodash 方法的参数(类似回调函数)。
+匿名函数可以用于函数式编程或 Lodash(类似于回调函数)。
```js
const arr = [1, 2, 3];
@@ -268,46 +260,42 @@ const double = arr.map(function(el) {
console.log(double); // [2, 4, 6]
```
-> 译者注: 其实匿名函数还有更多可细分的用处, 一般作为工程优化和最佳实践部分出现。
-
-###### References
+###### 参考
* https://www.quora.com/What-is-a-typical-usecase-for-anonymous-functions
* https://stackoverflow.com/questions/10273185/what-are-the-benefits-to-using-anonymous-functions-instead-of-named-functions-fo
-[[↑] Back to top](#js-questions)
+[[↑] 回到顶部](#js-问题)
-### How do you organize your code? (module pattern, classical inheritance?)
+### 你如何组织自己的代码?(使用模块模式(module pattern)还是经典继承(classical inheritance)?)
-In the past, I used Backbone for my models which encourages a more OOP approach, creating Backbone models and attaching methods to them.
+我以前使用 Backbone 组织我的模型(model),Backbone 鼓励采用面向对象的方法——创建 Backbone 模型,并为其添加方法。
-The module pattern is still great, but these days, I use the Flux architecture based on React/Redux which encourages a single-directional functional programming approach instead. I would represent my app's models using plain objects and write utility pure functions to manipulate these objects. State is manipulated using actions and reducers like in any other Redux application.
+模块模式仍然是很好的方式,但是现在我使用基于 React/Redux 的 Flux 体系结构,它鼓励使用单向函数编程的方法。我用普通对象(plain object)表示我的 app 模型,编写实用纯函数去操作这些对象。使用动作(actions)和化简器(reducers)来处理状态,就像其他 Redux 应用一样。
-I avoid using classical inheritance where possible. When and if I do, I stick to [these rules](https://medium.com/@dan_abramov/how-to-use-classes-and-sleep-at-night-9af8de78ccb4).
+我尽可能避免使用经典继承。如果非要这么做,我会坚持[这些原则](https://medium.com/@dan_abramov/how-to-use-classes-and-sleep-at-night-9af8de78ccb4)。
-[[↑] Back to top](#js-questions)
+[[↑] 回到顶部](#js-问题)
-
+### 宿主对象(host objects)和原生对象(native objects)的区别是什么?
-### 宿主对象(host objects)和本地对象(native objects)有什么区别?
+原生对象是由 ECMAScript 规范定义的 JavaScript 内置对象,比如`String`、`Math`、`RegExp`、`Object`、`Function`等等。
-`ECMA-262` 把本地对象(native object)定义为 `独立于宿主环境的 ECMAScript 实现提供的对象`, 比如 `String`, `Math`, `RegExp`, `Object`, `Function` 等等。
+宿主对象是由运行时环境(浏览器或 Node)提供,比如`window`、`XMLHTTPRequest`等等。
-所有非本地对象都是宿主对象(host object),即由 ECMAScript 实现的宿主环境(浏览器或者 nodejs)提供的对象, 比如 `window`, `XMLHTTPRequest` 等。
-
-###### References
+###### 参考
* https://stackoverflow.com/questions/7614317/what-is-the-difference-between-native-objects-and-host-objects
-[[↑] Back to top](#js-questions)
+[[↑] 回到顶部](#js-问题)
-### Difference between: `function Person(){}`, `var person = Person()`, and `var person = new Person()`?
+### 下列语句有何区别:`function Person(){}`、`var person = Person()`和`var person = new Person()`?
-This question is pretty vague. My best guess at its intention is that it is asking about constructors in JavaScript. Technically speaking, `function Person(){}` is just a normal function declaration. The convention is use PascalCase for functions that are intended to be used as constructors.
+这个问题问得很含糊。我猜这是在考察 JavaScript 中的构造函数(constructor)。从技术上讲,`function Person(){}`只是一个普通的函数声明。使用 PascalCase 方式命名函数作为构造函数,是一个惯例。
-`var person = Person()` invokes the `Person` as a function, and not as a constructor. Invoking as such is a common mistake if it the function is intended to be used as a constructor. Typically, the constructor does not return anything, hence invoking the constructor like a normal function will return `undefined` and that gets assigned to the variable intended as the instance.
+`var person = Person()`将`Person`以普通函数调用,而不是构造函数。如果该函数是用作构造函数的,那么这种调用方式是一种常见错误。通常情况下,构造函数不会返回任何东西,因此,像普通函数一样调用构造函数,只会返回`undefined`赋给用作实例的变量。
-`var person = new Person()` creates an instance of the `Person` object using the `new` operator, which inherits from `Person.prototype`. An alternative would be to use `Object.create`, such as: `Object.create(Person.prototype)`.
+`var person = new Person()`使用`new`操作符,创建`Person`对象的实例,该实例继承自`Person.prototype`。另外一种方式是使用`Object.create`,例如:Object.create(Person.prototype)`。
```js
function Person(name) {
@@ -323,15 +311,15 @@ console.log(person); // Person { name: "John" }
console.log(person.name); // "john"
```
-###### References
+###### 参考
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/new
-[[↑] Back to top](#js-questions)
+[[↑] 回到顶部](#js-问题)
-### What's the difference between `.call` and `.apply`?
+### `.call`和`.apply`有什么区别?
-Both `.call` and `.apply` are used to invoke functions and the first parameter will be used as the value of `this` within the function. However, `.call` takes in a comma-separated arguments as the next arguments while `.apply` takes in an array of arguments as the next argument. An easy way to remember this is C for `call` and comma-separated and A for `apply` and array of arguments.
+`.call`和`.apply`都用于调用函数,第一个参数将用作函数内this的值。然而,`.call`接受逗号分隔的参数作为后面的参数,而'.apply`接受一个参数数组作为后面的参数。一个简单的记忆方法是,从`call`中的 C 联想到逗号分隔(comma-separated),从`apply`中的 A 联想到数组(array)。
```js
function add(a, b) {
@@ -342,56 +330,55 @@ console.log(add.call(null, 1, 2)); // 3
console.log(add.apply(null, [1, 2])); // 3
```
-[[↑] Back to top](#js-questions)
+[[↑] 回到顶部](#js-问题)
-### Explain `Function.prototype.bind`.
+### 请说明`Function.prototype.bind`的用法。
-Taken word-for-word from [MDN](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_objects/Function/bind):
+摘自[MDN](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_objects/Function/bind):
-> The `bind()` method creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function is called.
+> `bind()`方法创建一个新的函数, 当被调用时,将其this关键字设置为提供的值,在调用新函数时,在任何提供之前提供一个给定的参数序列。
-In my experience, it is most useful for binding the value of `this` in methods of classes that you want to pass into other functions. This is frequently done in React components.
+根据我的经验,将`this`的值绑定到想要传递给其他函数的类的方法中是非常有用的。在React组件中经常这样做。
-###### References
+###### 参考
* https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_objects/Function/bind
-[[↑] Back to top](#js-questions)
-
-
+[[↑] 回到顶部](#js-问题)
-### 什么时候会用到 `document.write()`?
+### 什么时候会用到document.write()`?
-`document.write()` 将一串文本写入由 `document.open()` 打开的文档流中。`document.write()` 在页面加载后执行, 清除整个 `dom` 树(包括 `` 和 ``), 并使用参数替换. 这是一个很危险也容易被误用的方法。
+`document.write()` writes a string of text to a document stream opened by `document.open()`. When `document.write()` is executed after the page has loaded, it will call `document.open` which clears the whole document (`` and `` removed!) and replaces the contents with the given parameter value in string. Hence it is usually considered dangerous and prone to misuse.
+`document.write()`用来将一串文本写入由`document.open()`打开的文档流中。当页面加载后执行`document.write()`时,它将调用'document.open`,会清除整个文档(``和``会被移除!),并将文档内容替换成给定的字符串参数。因此它通常被认为是危险的并且容易被误用。
-网上有一些说法是将它用于代码分析, 或者是某些特殊情况(比如你希望[只有浏览器允许 JS 脚本执行时, 才显示样式](https://www.quirksmode.org/blog/archives/2005/06/three_javascrip_1.html)), 也可以在 HTML5 中用于[并行加载脚本并保留执行顺序](https://github.com/paulirish/html5-boilerplate/wiki/Script-Loading-Techniques#documentwrite-script-tag). 但是我怀疑这些可能性都已经过时了, 现在我们不用 `document.write()` 也能实现目的。
+网上有一些答案,解释了`document.write()`被用于分析代码中,或者[当你想包含只有在启用了 JavaScript 的情况下才能工作的样式](https://www.quirksmode.org/blog/archives/2005/06/three_javascrip_1.html)。它甚至在HTML5样板代码中用于[并行加载脚本并保持执行顺序](https://github.com/paulirish/html5-boilerplate/wiki/Script-Loading-Techniques#documentwrite-script-tag)!但是,我怀疑这些使用原因是过时的,现在可以在不使用`document.write()`的情况下实现。如果我的观点有错,请纠正我。
-###### References
+###### 参考
* https://www.quirksmode.org/blog/archives/2005/06/three_javascrip_1.html
* https://github.com/h5bp/html5-boilerplate/wiki/Script-Loading-Techniques#documentwrite-script-tag
-[[↑] Back to top](#js-questions)
+[[↑] 回到顶部](#js-问题)
-### What's the difference between feature detection, feature inference, and using the UA string?
+### 功能检测(feature detection)、功能推断(feature inference)和使用 UA 字符串之间有什么区别?
-**Feature Detection**
+功能检测(feature detection)
-Feature detection involves working out whether a browser supports a certain block of code, and running different code dependent on whether it does (or doesn't), so that the browser can always provide a working experience rather crashing/erroring in some browsers. For example:
+功能检测包括确定浏览器是否支持某段代码,以及是否运行不同的代码(取决于它是否执行),以便浏览器始终能够正常运行代码功能,而不会在某些浏览器中出现崩溃和错误。例如:
```js
if ('geolocation' in navigator) {
- // Can use navigator.geolocation
+ // 可以使用 navigator.geolocation
} else {
- // Handle lack of feature
+ // 处理 navigator.geolocation 功能缺失
}
```
-[Modernizr](https://modernizr.com/) is a great library to handle feature detection.
+[Modernizr](https://modernizr.com/)是处理功能检测的优秀工具。
-**Feature Inference**
+功能推断(feature inference)
-Feature inference checks for a feature just like feature detection, but uses another function because it assumes it will also exist, e.g.:
+功能推断与功能检测一样,会对功能可用性进行检查,但是在判断通过后,还会使用其他功能,因为它假设其他功能也可用,例如:
```js
if (document.getElementsByTagName) {
@@ -399,58 +386,56 @@ if (document.getElementsByTagName) {
}
```
-This is not really recommended. Feature detection is more foolproof.
+非常不推荐这种方式。功能检测更能保证万无一失。
-**UA String**
+UA 字符串
-This is a browser-reported string that allows the network protocol peers to identify the application type, operating system, software vendor or software version of the requesting software user agent. It can be accessed via `navigator.userAgent`. However, the string is tricky to parse and can be spoofed. For example, Chrome reports both as Chrome and Safari. So to detect Safari you have to check for the Safari string and the absence of the Chrome string. Avoid this method.
+这是一个浏览器报告的字符串,它允许网络协议对等方(network protocol peers)识别请求用户代理的应用类型、操作系统、应用供应商和应用版本。它可以通过`navigator.userAgent`访问。 然而,这个字符串很难解析并且很可能存在欺骗性。例如,Chrome 会同时作为 Chrome 和 Safari 进行报告。因此,要检测 Safari,除了检查 Safari 字符串,还要检查是否存在 Chrome 字符串。不要使用这种方式。
-###### References
+###### 参考
* https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Feature_detection
* https://stackoverflow.com/questions/20104930/whats-the-difference-between-feature-detection-feature-inference-and-using-th
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent
-[[↑] Back to top](#js-questions)
+[[↑] 回到顶部](#js-问题)
-### Explain Ajax in as much detail as possible.
+### 请尽可能详细地解释 Ajax。
-Ajax (asynchronous JavaScript and XML) is a set of web development techniques using many web technologies on the client side to create asynchronous web applications. With Ajax, web applications can send data to and retrieve from a server asynchronously (in the background) without interfering with the display and behavior of the existing page. By decoupling the data interchange layer from the presentation layer, Ajax allows for web pages, and by extension web applications, to change content dynamically without the need to reload the entire page. In practice, modern implementations commonly substitute JSON for XML due to the advantages of being native to JavaScript.
+Ajax(asynchronous JavaScript and XML)是使用客户端上的许多Web技术,创建异步Web应用的一种Web开发技术。借助Ajax,Web应用可以异步(在后台)向服务器发送数据和从服务器检索数据,而不会干扰现有页面的显示和行为。通过将数据交换层与表示层分离,Ajax允许网页和扩展Web应用程序动态更改内容,而无需重新加载整个页面。实际上,现在通常将JSON替换为XML,因为 JavaScript 对 JSON 有原生支持优势。
-The `XMLHttpRequest` API is frequently used for the asynchronous communication or these days, the `fetch` API.
+`XMLHttpRequest` API经常用于异步通信。此外还有最近流行的`fetch` API。
-###### References
+###### 参考
* https://en.wikipedia.org/wiki/Ajax_(programming)
* https://developer.mozilla.org/en-US/docs/AJAX
-[[↑] Back to top](#js-questions)
+[[↑] 回到顶部](#js-问题)
-
+### 使用Ajax的优缺点分别是什么?
-### `ajax` 技术有哪些优点和缺点?
+优点
-**优点**
+* 交互性更好。来自服务器的新内容可以动态更改,无需重新加载整个页面。
+* 减少与服务器的连接,因为脚本和样式只需要被请求一次。
+* 状态可以维护在一个页面上。JavaScript 变量和 DOM 状态将得到保持,因为主容器页面未被重新加载。
+* 基本上包括大部分 SPA 的优点。
-* 交互性更好. 动态更改内容, 无需重新加载整个页面
-* 减少与服务器的连接, 因为 `scripts` 和 `stylesheets` 只需要被请求一次
-* Webapp 的状态可以维护在页面上, JavaScript 变量和 DOM 状态会一直保持
-* 基本上和 `SPA` 的优点一致
+缺点
-**缺点**
+* 动态网页很难收藏。
+* 如果 JavaScript 已在浏览器中被禁用,则不起作用。
+* 有些网络爬虫不执行 JavaScript,也不会看到 JavaScript 加载的内容。
+* 基本上包括大部分 SPA 的缺点。
-* 动态网页不容易被收藏
-* 浏览器禁用 JavaScript 后, 页面不能正常访问
-* 有些网络爬虫不执行 `JavaScript`, 也不会看到动态加载的内容
-* 基本上和 `SPA` 的缺点一致
+[[↑] 回到顶部](#js-问题)
-[[↑] Back to top](#js-questions)
+### 请说明 JSONP 的工作原理,以及它为什么不是真正的 Ajax?
-### Explain how JSONP works (and how it's not really Ajax).
+JSONP(带填充的JSON)是一种通常用于绕过Web浏览器中的跨域限制的方法,因为 Ajax 不允许跨域请求。
-JSONP (JSON with Padding) is a method commonly used to bypass the cross-domain policies in web browsers because Ajax requests from the current page to a cross-origin domain is not allowed.
-
-JSONP works by making a request to a cross-origin domain via a `