In JavaScript, any function can return a new object. When it’s not a constructor function or class, it’s called a factory function.
class Foo {}
console.log(typeof Foo); // function, ES6 desugared class
$('body').keypress(function (e) { | |
if(e.which === 13) { | |
e.preventDefault(); | |
} | |
}) |
exports.config = { | |
// See http://brunch.io/#documentation for docs. | |
files: { | |
javascripts: { | |
joinTo: "js/app.js" | |
// To use a separate vendor.js bundle, specify two files path | |
// http://brunch.io/docs/config#-files- | |
// joinTo: { | |
// "js/app.js": /^js/, |
-- How to tell what my timezone offset of the database is | |
select @@global.time_zone, @@session.time_zone; | |
select timediff( now(), utc_timestamp()); |
-- See the size of the directory | |
du -sh /directory/path |
let axios = { // mocks | |
get: function(x) { | |
return new Promise(resolve => { | |
setTimeout(() => { | |
resolve({data: x}) | |
}, 2000) | |
}) | |
}} | |
let query = 'mangos' | |
async function fetchData(query) { |
SHOW ENGINE INNODB STATUS; -- InnoDB Monitor output |
const drivers = ['Vettel', 'Alonso', 'Hamilton'] | |
console.log('Length', drivers.length) // Length = 3 | |
drivers.length = 10 | |
console.log('Length', drivers.length, drivers) // Length = 10 | |
// In Javascript, array is list-like Object | |
console.log(Object.keys(drivers)) |