Message from JavaScript discussions

February 2017

— Endgoal is super speedy cms that lazy loads all pages in the background as Blob

— 

#!/usr/bin/env node
var fs = require('fs');
var express = require('express');
var app = express();

app.use(express.static('public'));
app.get('/listPages', function (req, res) {
fs.readdir("pages", function (error, contents) {
if (error) {
throw error;
}
res.send(contents);
});
});

app.listen(3000, function () {
console.log('Example app listening on port 3000!')
});

baby

— I need some help

— I am running into an issue in a function with a default parameter

— For some reason even if I enter the parameter in the invokation, the default one is applied instead

— console.log'd arguments and, I can only see one of them, but not the last one

— Can we see some code?

— 

// Build a standalone Report - Constructor
Report: function () {
var entries = [];
var entryCount = 0;
this.entryCount = entryCount;
this.addEntry = function (entryText, title = "test") {
console.log(arguments);
entries.push({
msg: entryText,
title: title
});
this.entryCount++;
};
this.dumpReport = function (type = "log") {
fa.forEach(entries, function (loc, entry) {
debug.group(entry.title + ":");
debug[type](entry.msg);
debug.groupEnd();
});
};
},

Message permanent page

— Constructed:

var report = new debug.Report();

— Invoked:

report.addEntry(exception, "In Action \"" + actionName + "\"");

— The issue happens in the first function, this.addEntry

— title is test even though there's a parameter there in the invokation