From 09c5d181ffbe72db137027b4e67dc46b0d511f3a Mon Sep 17 00:00:00 2001 From: "qingwei.li" Date: Wed, 1 Mar 2017 17:01:21 +0800 Subject: [PATCH] add website, fixed #6 --- .nojekyll | 0 README.md | 144 +++++++++++++++++++++++++-------------------------- _navbar.md | 8 +++ index.html | 27 ++++++++++ package.json | 11 ++++ 5 files changed, 118 insertions(+), 72 deletions(-) create mode 100644 .nojekyll create mode 100644 _navbar.md create mode 100644 index.html create mode 100644 package.json diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/README.md b/README.md index 714b187..43dbe52 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![ElemeFE-background](https://github.com/ElemeFE/node-interview/blob/master/assets/ElemeFE-background.png) +![ElemeFE-background](assets/ElemeFE-background.png) # 如何通过饿了么 Node.js 面试 @@ -8,127 +8,127 @@ Hi, 欢迎来到 ElemeFE, 如标题所示本教程的目的是教你如何通过 如果你觉得大多不了解, 就不用投简历了 (这样两边都节约了时间), 如果你觉得大都有了解或者**光看大纲都都觉得很简单那么欢迎投递简历至 ElemeFe (fe.job@ele.me)**. -### 导读 +## 导读 -虽然说目的是要通过面试, 但是本教程并不是简单的把所有面试题列出来, 而主要是将面试中需要确认你是否懂的点列举出来, 并进行一定程度的讨论. +虽然说目的是要通过面试, 但是本教程并不是简单的把所有面试题列出来, 而**主要是将面试中需要确认你是否懂的点列举出来**, 并进行一定程度的讨论. 本文将一些常见的问题划分归类, 每类标明涵盖的一些`覆盖点`, 并且列举几个`常见问题`, 通常这些问题都是 2~3 年工作经验需要了解或者面对的. 如果你对某类问题感兴趣, 或者想知道其中列举问题的答案, 可以通过该类下方的 `阅读更多` 查看更多的内容. 整体上大纲列举的并不是很全面, 细节上覆盖率不高, 很多讨论只是点到即止, 希望大家带着问题去思考. -## [Js 基础问题](https://github.com/ElemeFE/node-interview/blob/master/sections/js-basic.md) +## [Js 基础问题](sections/js-basic.md) > 与前端 Js 不同, 后端是直面服务器的, 更加偏向内存方面. ### 覆盖点 -* [`[Basic]` 类型判断](https://github.com/ElemeFE/node-interview/blob/master/sections/js-basic.md#类型判断) -* [`[Basic]` 作用域](https://github.com/ElemeFE/node-interview/blob/master/sections/js-basic.md#作用域) -* [`[Basic]` 引用传递](https://github.com/ElemeFE/node-interview/blob/master/sections/js-basic.md#引用传递) -* [`[Basic]` 内存释放](https://github.com/ElemeFE/node-interview/blob/master/sections/js-basic.md#内存释放) -* [`[Basic]` ES6 新特性](https://github.com/ElemeFE/node-interview/blob/master/sections/js-basic.md#es6-新特性) +* [`[Basic]` 类型判断](sections/js-basic.md#类型判断) +* [`[Basic]` 作用域](sections/js-basic.md#作用域) +* [`[Basic]` 引用传递](sections/js-basic.md#引用传递) +* [`[Basic]` 内存释放](sections/js-basic.md#内存释放) +* [`[Basic]` ES6 新特性](sections/js-basic.md#es6-新特性) ### 常见问题 -* js 中什么类型是引用传递, 什么类型是值传递? 如何将值类型的变量以引用的方式传递? [[more]](https://github.com/ElemeFE/node-interview/blob/master/sections/js-basic.md#q-value) +* js 中什么类型是引用传递, 什么类型是值传递? 如何将值类型的变量以引用的方式传递? [[more]](sections/js-basic.md#q-value) * js 中, 0.1 + 0.2 === 0.3 是否为 true ? 在不知道浮点数位数时应该怎样判断两个浮点数之和与第三数是否相等? -* const 定义的 Array 中间元素能否被修改? 如果可以, 那 const 的意义是? [[more]](https://github.com/ElemeFE/node-interview/blob/master/sections/js-basic.md#q-const) -* Javascript 中不同类型以及不同环境下变量的内存都是何时释放? [[more]](https://github.com/ElemeFE/node-interview/blob/master/sections/js-basic.md#q-mem) +* const 定义的 Array 中间元素能否被修改? 如果可以, 那 const 的意义是? [[more]](sections/js-basic.md#q-const) +* Javascript 中不同类型以及不同环境下变量的内存都是何时释放? [[more]](sections/js-basic.md#q-mem) -[阅读更多](https://github.com/ElemeFE/node-interview/blob/master/sections/js-basic.md) +[阅读更多](sections/js-basic.md) -## [模块](https://github.com/ElemeFE/node-interview/blob/master/sections/module.md) +## [模块](sections/module.md) -* [`[Basic]` 模块机制](https://github.com/ElemeFE/node-interview/blob/master/sections/module.md#模块机制) -* [`[Basic]` 热更新](https://github.com/ElemeFE/node-interview/blob/master/sections/module.md#热更新) -* [`[Basic]` 上下文](https://github.com/ElemeFE/node-interview/blob/master/sections/module.md#上下文) +* [`[Basic]` 模块机制](sections/module.md#模块机制) +* [`[Basic]` 热更新](sections/module.md#热更新) +* [`[Basic]` 上下文](sections/module.md#上下文) ### 常见问题 -* a.js 和 b.js 两个文件互相 require 是否会死循环? 双方是否能导出变量? 如何从设计上避免这种问题? [[more]](https://github.com/ElemeFE/node-interview/blob/master/sections/module.md#q-loop) -* 如果 a.js require 了 b.js, 那么在 b 中定义全局变量 `t = 111` 能否在 a 中直接打印出来? [[more]](https://github.com/ElemeFE/node-interview/blob/master/sections/module.md#q-global) -* 如何在不重启 node 进程的情况下热更新一个 js/json 文件? 这个问题本身是否有问题? [[more]](https://github.com/ElemeFE/node-interview/blob/master/sections/module.md#q-hot) +* a.js 和 b.js 两个文件互相 require 是否会死循环? 双方是否能导出变量? 如何从设计上避免这种问题? [[more]](sections/module.md#q-loop) +* 如果 a.js require 了 b.js, 那么在 b 中定义全局变量 `t = 111` 能否在 a 中直接打印出来? [[more]](sections/module.md#q-global) +* 如何在不重启 node 进程的情况下热更新一个 js/json 文件? 这个问题本身是否有问题? [[more]](sections/module.md#q-hot) -[阅读更多](https://github.com/ElemeFE/node-interview/blob/master/sections/module.md) +[阅读更多](sections/module.md) -## [事件/异步](https://github.com/ElemeFE/node-interview/blob/master/sections/event-async.md) +## [事件/异步](sections/event-async.md) -* [`[Basic]` Promise](https://github.com/ElemeFE/node-interview/blob/master/sections/event-async.md#promise) -* [`[Doc]` Events (事件)](https://github.com/ElemeFE/node-interview/blob/master/sections/event-async.md#events) -* [`[Doc]` Timers (定时器)](https://github.com/ElemeFE/node-interview/blob/master/sections/event-async.md#timers) -* [`[Point]` 阻塞/异步](https://github.com/ElemeFE/node-interview/blob/master/sections/event-async.md#阻塞异步) -* [`[Point]` 并行/并发](https://github.com/ElemeFE/node-interview/blob/master/sections/event-async.md#并行并发) +* [`[Basic]` Promise](sections/event-async.md#promise) +* [`[Doc]` Events (事件)](sections/event-async.md#events) +* [`[Doc]` Timers (定时器)](sections/event-async.md#timers) +* [`[Point]` 阻塞/异步](sections/event-async.md#阻塞异步) +* [`[Point]` 并行/并发](sections/event-async.md#并行并发) ### 常见问题 -* Promise 中 .then 的第二参数与 .catch 有什么区别? [[more]](https://github.com/ElemeFE/node-interview/blob/master/sections/event-async.md#q-1) -* Eventemitter 的 emit 是同步还是异步? [[more]](https://github.com/ElemeFE/node-interview/blob/master/sections/event-async.md#q-2) -* 如何判断接口是否异步? 是否只要有回调函数就是异步? [[more]](https://github.com/ElemeFE/node-interview/blob/master/sections/event-async.md#q-3) -* nextTick, setTimeout 以及 setImmediate 三者有什么区别? [[more]](https://github.com/ElemeFE/node-interview/blob/master/sections/event-async.md#q-4) -* 如何实现一个 sleep 函数? [[more]](https://github.com/ElemeFE/node-interview/blob/master/sections/event-async.md#q-5) -* 如何实现一个异步的 reduce? (注:不是异步完了之后同步 reduce) [[more]](https://github.com/ElemeFE/node-interview/blob/master/sections/event-async.md#q-6) +* Promise 中 .then 的第二参数与 .catch 有什么区别? [[more]](sections/event-async.md#q-1) +* Eventemitter 的 emit 是同步还是异步? [[more]](sections/event-async.md#q-2) +* 如何判断接口是否异步? 是否只要有回调函数就是异步? [[more]](sections/event-async.md#q-3) +* nextTick, setTimeout 以及 setImmediate 三者有什么区别? [[more]](sections/event-async.md#q-4) +* 如何实现一个 sleep 函数? [[more]](sections/event-async.md#q-5) +* 如何实现一个异步的 reduce? (注:不是异步完了之后同步 reduce) [[more]](sections/event-async.md#q-6) -[阅读更多](https://github.com/ElemeFE/node-interview/blob/master/sections/event-async.md) +[阅读更多](sections/event-async.md) -## [进程](https://github.com/ElemeFE/node-interview/blob/master/sections/process.md) +## [进程](sections/process.md) -* [`[Doc]` Process (进程)](https://github.com/ElemeFE/node-interview/blob/master/sections/process.md#process) -* [`[Doc]` Child Processes (子进程)](https://github.com/ElemeFE/node-interview/blob/master/sections/process.md#child-process) -* [`[Doc]` Cluster (集群)](https://github.com/ElemeFE/node-interview/blob/master/sections/process.md#cluster) -* [`[Basic]` 进程间通信](https://github.com/ElemeFE/node-interview/blob/master/sections/process.md#进程间通信) -* [`[Basic]` 守护进程](https://github.com/ElemeFE/node-interview/blob/master/sections/process.md#守护进程) +* [`[Doc]` Process (进程)](sections/process.md#process) +* [`[Doc]` Child Processes (子进程)](sections/process.md#child-process) +* [`[Doc]` Cluster (集群)](sections/process.md#cluster) +* [`[Basic]` 进程间通信](sections/process.md#进程间通信) +* [`[Basic]` 守护进程](sections/process.md#守护进程) ### 常见问题 -* 进程的当前工作目录是什么? 有什么作用? [[more]](https://github.com/ElemeFE/node-interview/blob/master/sections/process.md#q-cwd) -* child_process.fork 与 POSIX 的 fork 有什么区别? [[more]](https://github.com/ElemeFE/node-interview/blob/master/sections/process.md#q-fork) -* 父进程或子进程的死亡是否会影响对方? 什么是孤儿进程? [[more]](https://github.com/ElemeFE/node-interview/blob/master/sections/process.md#q-child) -* cluster 是如何保证负载均衡的? [[more]](https://github.com/ElemeFE/node-interview/blob/master/sections/process.md#how-it-works) -* 什么是守护进程? 如何实现守护进程? [[more]](https://github.com/ElemeFE/node-interview/blob/master/sections/process.md#守护进程) +* 进程的当前工作目录是什么? 有什么作用? [[more]](sections/process.md#q-cwd) +* child_process.fork 与 POSIX 的 fork 有什么区别? [[more]](sections/process.md#q-fork) +* 父进程或子进程的死亡是否会影响对方? 什么是孤儿进程? [[more]](sections/process.md#q-child) +* cluster 是如何保证负载均衡的? [[more]](sections/process.md#how-it-works) +* 什么是守护进程? 如何实现守护进程? [[more]](sections/process.md#守护进程) -[阅读更多](https://github.com/ElemeFE/node-interview/blob/master/sections/process.md) +[阅读更多](sections/process.md) -## [IO](https://github.com/ElemeFE/node-interview/blob/master/sections/io.md) +## [IO](sections/io.md) -* [`[Doc]` Buffer](https://github.com/ElemeFE/node-interview/blob/master/sections/io.md#buffer) -* [`[Doc]` String Decoder (字符串解码)](https://github.com/ElemeFE/node-interview/blob/master/sections/io.md#string-decoder) -* [`[Doc]` Stream (流)](https://github.com/ElemeFE/node-interview/blob/master/sections/io.md#stream) -* [`[Doc]` Console (控制台)](https://github.com/ElemeFE/node-interview/blob/master/sections/io.md#console) -* [`[Doc]` File System (文件系统)](https://github.com/ElemeFE/node-interview/blob/master/sections/io.md#file) -* [`[Doc]` Readline](https://github.com/ElemeFE/node-interview/blob/master/sections/io.md#readline) -* [`[Doc]` REPL](https://github.com/ElemeFE/node-interview/blob/master/sections/io.md#repl) +* [`[Doc]` Buffer](sections/io.md#buffer) +* [`[Doc]` String Decoder (字符串解码)](sections/io.md#string-decoder) +* [`[Doc]` Stream (流)](sections/io.md#stream) +* [`[Doc]` Console (控制台)](sections/io.md#console) +* [`[Doc]` File System (文件系统)](sections/io.md#file) +* [`[Doc]` Readline](sections/io.md#readline) +* [`[Doc]` REPL](sections/io.md#repl) ### 常见问题 -* Buffer 一般用于处理什么数据? 其长度能否动态变化? [[more]](https://github.com/ElemeFE/node-interview/blob/master/sections/io.md#buffer) -* Stream 的 highWaterMark 与 drain 事件是什么? 二者之间的关系是? [[more]](https://github.com/ElemeFE/node-interview/blob/master/sections/io.md#缓冲区) -* Stream 的 pipe 的作用是? 在 pipe 的过程中数据是引用传递还是拷贝传递? [[more]](https://github.com/ElemeFE/node-interview/blob/master/sections/io.md#pipe) -* 什么是文件描述符? 输入流/输出流/错误流是什么? [[more]](https://github.com/ElemeFE/node-interview/blob/master/sections/io.md#file) -* console.log 是同步还是异步? 如何实现一个 console.log? [[more]](https://github.com/ElemeFE/node-interview/blob/master/sections/io.md#console) -* 如何* `[Doc]` HTTP同步的获取用户的输入? [[more]](https://github.com/ElemeFE/node-interview/blob/master/sections/io.md#如何同步的获取用户的输入) -* Readline 是如何实现的? (有思路即可) [[more]](https://github.com/ElemeFE/node-interview/blob/master/sections/io.md#readline) +* Buffer 一般用于处理什么数据? 其长度能否动态变化? [[more]](sections/io.md#buffer) +* Stream 的 highWaterMark 与 drain 事件是什么? 二者之间的关系是? [[more]](sections/io.md#缓冲区) +* Stream 的 pipe 的作用是? 在 pipe 的过程中数据是引用传递还是拷贝传递? [[more]](sections/io.md#pipe) +* 什么是文件描述符? 输入流/输出流/错误流是什么? [[more]](sections/io.md#file) +* console.log 是同步还是异步? 如何实现一个 console.log? [[more]](sections/io.md#console) +* 如何* `[Doc]` HTTP同步的获取用户的输入? [[more]](sections/io.md#如何同步的获取用户的输入) +* Readline 是如何实现的? (有思路即可) [[more]](sections/io.md#readline) -[阅读更多](https://github.com/ElemeFE/node-interview/blob/master/sections/io.md) +[阅读更多](sections/io.md) ## Network -* [`[Doc]` Net (网络)](https://github.com/ElemeFE/node-interview/blob/master/sections/network.md#net) -* [`[Doc]` UDP/Datagram](https://github.com/ElemeFE/node-interview/blob/master/sections/network.md#udp) -* [`[Doc]` HTTP](https://github.com/ElemeFE/node-interview/blob/master/sections/network.md#http) -* [`[Doc]` DNS (域名服务器)](https://github.com/ElemeFE/node-interview/blob/master/sections/network.md#dns) -* [`[Doc]` ZLIB (压缩)](https://github.com/ElemeFE/node-interview/blob/master/sections/network.md#zlib) -* [`[Point]` RPC](https://github.com/ElemeFE/node-interview/blob/master/sections/network.md#rpc) +* [`[Doc]` Net (网络)](sections/network.md#net) +* [`[Doc]` UDP/Datagram](sections/network.md#udp) +* [`[Doc]` HTTP](sections/network.md#http) +* [`[Doc]` DNS (域名服务器)](sections/network.md#dns) +* [`[Doc]` ZLIB (压缩)](sections/network.md#zlib) +* [`[Point]` RPC](sections/network.md#rpc) ### 常见问题 -* HTTP 协议中的 POST 和 PUT 有什么区别? [[more]](https://github.com/ElemeFE/node-interview/blob/master/sections/network.md#q-post-put) -* TCP/UDP 的区别? TCP 粘包是怎么回事,如何处理? UDP 有粘包吗? [[more]](https://github.com/ElemeFE/node-interview/blob/master/sections/network.md#q-tcp-udp) -* `TIME_WAIT` 是什么情况? 出现过多的 `TIME_WAIT` 可能是什么原因? [[more]](https://github.com/ElemeFE/node-interview/blob/master/sections/network.md#q-time-wait) +* HTTP 协议中的 POST 和 PUT 有什么区别? [[more]](sections/network.md#q-post-put) +* TCP/UDP 的区别? TCP 粘包是怎么回事,如何处理? UDP 有粘包吗? [[more]](sections/network.md#q-tcp-udp) +* `TIME_WAIT` 是什么情况? 出现过多的 `TIME_WAIT` 可能是什么原因? [[more]](sections/network.md#q-time-wait) * socket hang up 是什么意思? 一般什么情况下出现? * 列举几个提高网络传输速度的办法? -[阅读更多](https://github.com/ElemeFE/node-interview/blob/master/sections/network.md) +[阅读更多](sections/network.md) ## OS diff --git a/_navbar.md b/_navbar.md new file mode 100644 index 0000000..d2cc4fc --- /dev/null +++ b/_navbar.md @@ -0,0 +1,8 @@ +- [首页](/) +- 章节 + - [事件/异步](sections/event-async) + - [IO](sections/io) + - [Javascript 基础问题](sections/js-basic) + - [模块](sections/module) + - [Network](sections/network) + - [进程](sections/process) diff --git a/index.html b/index.html new file mode 100644 index 0000000..9302a6d --- /dev/null +++ b/index.html @@ -0,0 +1,27 @@ + + + + + Node.js Interview + + + + + + +
+ + + + \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..2893a3e --- /dev/null +++ b/package.json @@ -0,0 +1,11 @@ +{ + "name": "node-interview", + "repository": "git@github.com:ElemeFE/node-interview.git", + "scripts": { + "serve": "docsify serve" + }, + "license": "MIT", + "dependencies": { + "docsify-cli": "^3.0.1" + } +}