当模块的文件名是index.js,加载模块时可以使用模块所在目录的路径代替模块文件路径,以下两条语句等价。
var cat = require('/home/user/lib/cat');
var cat = require('/home/user/lib/cat/index');
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
machine github.com | |
login technoweenie | |
password SECRET | |
machine api.github.com | |
login technoweenie | |
password SECRET |
当模块的文件名是index.js,加载模块时可以使用模块所在目录的路径代替模块文件路径,以下两条语句等价。
var cat = require('/home/user/lib/cat');
var cat = require('/home/user/lib/cat/index');
Here is our DOM
body
|
|-h1
| |
| |-"Traversing the ..."
|
|-h2
| |
function callback(a, b) { | |
return function() { | |
console.log('sum = ', (a+b)); | |
} | |
} | |
var x = 1, y = 2; | |
document.getElementById('someelem').addEventListener('click', callback(x, y)); |
I hereby claim:
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
# last command | |
!! | |
# last command beginning with xyz | |
!xyz | |
# print rather than excuting last command | |
!!:p | |
# the end of previous command |
var res = {}; | |
function traversal(item, pathNodes = []) { | |
if(typeof item !== 'object') { | |
res[pathNodes.join('.')] = item; | |
return ; | |
} | |
for(let x in item) { | |
traversal(item[x], pathNodes.concat(x)); | |
} |