common Iv questions Flashcards
what is node js
an open source server side runtime environment
built on Chrome’s V8 engine
provides a event-driven, non-blocking IO and cross platoform run time environment
can build highly scalable server-side applicaitions using javascript
**what problem does node.js solve?
allows you develop backend with Javascrit
provides event driven programming and unblocking IO solution that ensure your app can scale
the multi threads way of solving IO issue/ network requests cost too much.
what is event-driven programming?
when event get fired, callbacks will be executed
what is node.js process model?
Node js runs a single proess.
the application code runs in single thread (compare with multi-threads, it costs less)
the thread is responsible for event loops, IO operations will delegated to other threads, and node.js provides async programming pattern, so one single threads can handle many user requests(thus hightly scalable).
key features of node.js
asynchronous and event driven: all APIs of Node.js are asynchrinous.
it will execute in the background and continue processing other requests
(**)what is Symbol data type? using code to ilustrate
introduced in ES6.
const name = Symbol()
const person = {
[name]: ‘Rika’
}
(**) what is Buffer data type in node.js? use code to illustrate
let b = new Buffer(10000)
let str = “————”
b.write(str);
console.log(str.length) // maybe 10
console.log(b.length) // 10000
core modules in node js
assert
console
crypto
http
url
querystring
path
fs
util
what is assert module
provides a set of assertion functions useful for testing
what is the console module
provides a simple debugging console
(**)what is crypto module
provides cryptographic functionality
what is the http module
used for creating web servers
(**)what is the url module
URL resolution and parsing