New project, should I use ES 6 or ES 5.1?
So, despite all the red showing that ES 6 isn't supported by older browsers
I mean, ES5 was standardized in 2009. 8 years ago. According to Moore's law, that's like 6 generations, or roughly the equivalent of 120 human years. Best not to start with something that ancient! I'm going with ES 6.
Sigh ... well, one drawback is that my muscle memory types 'var' when now I guess I should be using 'let' ...😆
More promises and better ways
I've got a lot to learn. But I found this, it was clear and easy to understand. Kudos to the folks at Tao of Code
I started with this
database.js
And used it like this
But I don't like the .database(); on the end.
To fix that, I changed it to this
database.js
And use it like this.
Little things, but those parentheses really matter. I had to make sure to export the results of the executed function, not the function...
Requiring and importing code ... yeah parentheses matter!
I started with this
database.js
module.exports.database = function () { return mysql.createPool(config.database);};
And used it like this
let Database = require ('./database').database();
But I don't like the .database(); on the end.
To fix that, I changed it to this
database.js
module.exports = function () { return mysql.createPool(config.database);}();
And use it like this.
let Database = require ('./database');
Little things, but those parentheses really matter. I had to make sure to export the results of the executed function, not the function...
No comments:
Post a Comment