Posts by André • 63 points
2 posts
-
3
votes1
answer663
viewsQ: How the Express Router function works
To use a middleware in Express, I do as the code below: var express = require('express'); var app = express(); app.use('/', function(req, res, next) { console.log('Middleware!'); }); However, I…
-
3
votes4
answers135
viewsQ: How does object copying work?
var a = {a: 1, b: 2}; var b = a; b.a = 3; In the code above, b. a becomes worth 3, and a. a also becomes worth 3. var a = {a: 1, b: 2}; function b(objeto) { objeto.a = 3; } b(a); In the above code,…