====== Javascript interview ====== ===== Javascript ===== ==== 問答題 ==== Reference: https://stackoverflow.com/questions/1684917/what-questions-should-a-javascript-programmer-be-able-to-answer [[https://jsfiddle.net/questwork/ttmyG/|Why would this code not work as expected? Is anything missing?]] class User { constructor(name) { this.name = name; } } [[https://jsfiddle.net/questwork/72pHB/|Why does it alert undefined when I declared the jack variable to be 'Jack'?]] [[https://jsfiddle.net/questwork/Ge9ta/|What will this code alert? Why?]] [[https://jsfiddle.net/questwork/6QppX/|Why does the second alert say undefined?]] [[http://jsfiddle.net/questwork/qj2z7/|Why do the anchors, when clicked on, alert -1 instead of their respective counter inside of the loop?]] http://jsrun.net/QpbKp/edit The difference is scoping. var is scoped to the nearest function block and let is scoped to the nearest enclosing block. * Function.prototype.apply() 是什麼呢? * ES6 跟 ES5 有什么差别?请以代码举例。 * What is JSON? * Explain MVC * 什么是 Callback? * 什么是 Promise? * Callback 跟 Promise 有什么差别?请举例。 * 什么是设计模式 Design Pattern?请指出三个设计模式并以代码说明其中一个。 ==== 習作題 ==== 數列 http://jsfiddle.net/questwork/nfb7B/ ===== NodeJS ===== Node.js event loop reference: https://blog.risingstack.com/node-js-at-scale-understanding-node-js-event-loop/ https://jsfiddle.net/questwork/10497gs8/ ===== MongoDB ===== 假设你要做一个图书管理系统。你会怎样设计 MongoDB document 以达到以下需求? * 读者能以作者姓名丶分类丶书名丶出版社丶年份找书籍。 * 请写出以作者姓名或书名的 Query? ===== Framework ===== * 有没有使用 Node.js + Express + MongoDB + Mongoose 的经验?请举例。 * 有没有使用 oAuth 及 Passport.js 的经验?请举例。 * 有没有使用 Backbone.js 的经验?什么是 Model, View?请举例。 * 有没有使用 ReactJS 的经验?请举例。