Node.js 知識大挑戰
- 請說明 Node.js 和 V8 的關係?Node 沒有 V8 可否正常運行?
- How come when you declare a global variable in any Node.js file it’s not really global to all modules?
- Export 一個 Node 模塊的 API 時,爲何有時能夠用
exports
有時卻必須使用 module.exports
?
- 不用相對路徑是否能夠實現 require 本地文件(local files)?
- 一個應用是否能夠同時使用某個包的多個不一樣版本?
- 什麼是 Event Loop?它是 V8 的一部分嗎?
- 什麼是調用棧 (Call Stack)?它是 V8 的一部分嗎?
setImmediate
和 process.nextTick
的區別?
- How do you make an asynchronous function return a value?
- 回調能和 promise 一塊兒使用嗎?若是能的話,有幾種方式?
- What Node module is implemented by most other Node modules?
spawn
、exec
與 fork
的主要區別?
- cluster 模塊如何工做?它跟負載均衡的區別是?
--harmony-*
標誌是什麼?
- 如何讀取並檢查 Node.js 進程的內存使用狀況?
- 當調用棧和事件循環都爲空時,Node 將會發生什麼?
- V8 對象和函數模板是什麼?
- 什麼是 libuv? Node.js 怎麼使用它的?
- 如何使 Node 的 REPL 始終使用 JavaScript 嚴格模式?
- 什麼是
process.argv
?它擁有哪些數據?
- 如何實如今 Node 進程退出前執行最後一個操做?這個能異步執行嗎?
- 有哪些能夠在 Node REPL 中使用的內置 dot commands?
- 除了 V8 與 libuv,Node 還有其它外部依賴嗎?
- 進程
uncaughtException
事件有什麼問題?它與 exit
事件有什麼不一樣?
- Node REPL 中
_
的含義?
- Node 緩衝區(buffer)佔用 V8 內存嗎?它們大小可調嗎?
Buffer.alloc
與 Buffer.allocUnsafe
的區別?
- 緩衝區 (buffer) 上的
slice
與數組(array)上的區別?
string_decoder
模塊的做用?它與轉換緩衝區爲字符串有什麼區別?
- require 函數的五個主要步驟?
- 如何檢查本地模塊 (local module) 是否存在?
package.json
中 main
屬性的做用?
- 什麼是循環模塊引用?如何避免?
- require 函數支持的自動嘗試文件後綴是哪三個?
- 建立一個 http server 而且返回一個響應,爲何
end()
函數是必須的?
- 什麼場景下能使用
*Sync
方法?
- 如何僅打印多層嵌套對象的第一層?How can you print only one level of a deeply nested object?
node-gyp
包的做用?
- 如何實現
exports
, require
和 module
在每一個模塊中均全局可用,可是在每一個模塊中卻不一樣?
- 假設執行一個只有一行
console.log(arguments);
的 node 腳本,請問輸出是什麼?
- 如何實現一個模塊既能被其餘模塊 require 引用又能直接經過
node
命令行調用?
- 請給出一個 node 中既可讀又可寫的內置流 (stream) 的例子?
- 在 node 腳本中執行
cluster.fork()
將會發生什麼?
- What’s the difference between using event emitters and using simple callback functions to allow for asynchronous handling of code?
console.time
的做用?
- What’s the difference between the Paused and the Flowing modes of readable streams?
- Node 命令的
--inspect
參數的做用?
- 如何從已經鏈接的套接字中讀取數據?
require
函數總會緩存引用的模塊。若是須要屢次執行所引用模塊中的代碼,你會怎麼作?
- 使用流 (stream) 時,什麼場景下使用 pipe 函數?什麼場景下使用事件?這兩種方法能夠一塊兒使用嗎?
歡迎關注本站公眾號,獲取更多信息