• Yiyu's Dev Blog
  • ABOUT
  • ARCHIVES
  • RSS
Search ...
Search ...

Tag: es6

Tags

| 2019-07-01

[nodejs] module.exports 與 exports 的差異

前言nodejs 中有許多的特性或是方便的功能我們會使用,但實際上不知道內部處理的機制。本篇要探討的是匯出模組的兩種方式 modules.exports 以及 exports 結論(TL;DR) The exports variable is available within a module’s file-level scope, and is assigned the value of module.exports before the module is evaluat ...

yiyu0x
yiyu0x
2 min read
| 2019-03-29

了解nodeJS中的this

“This” in nodeJS以下討論 nodeJS 中的 this,與 javascript 中的 this 不同,請不要搞混了。 function 外的 thisfunction 外的 this 指向 module.exports 1console.log('outside: ', this) // {} 12module.exports.bar = 3console.log('outside: ', this) // outside: { bar: 3 } 切記 ...

yiyu0x
yiyu0x
4 min read
| 2019-03-25

了解javesvript中的var

記錄幾個月前幫助同學遇到的一個問題,同時了解背後的原理。 12345for (var i = 0; i 5; i++) { setTimeout(() => { console.log(i) }, 0)} output: 5 5 5 5 5 很多人會認為 output 應該為 0 1 2 3 4 要記得 callback function 會被丟到 callback queue 等到 thread 有空才去執行,所以一共有 5 個 callback function ...

yiyu0x
yiyu0x
2 min read
— Yiyu's Dev Blog —

Recent Posts

  • 2025 Life Update
  • EKS ELB 獲取 Client IP 方法紀錄
  • 建立 Reliable EKS 記錄
MORE →

Tag Cloud

AWS CI/CD DNS Docker DroneCI EKS ELB Kubernetes Linux c cgroup container ctf docker es6 fp http2 javascript kubernetes life linux macOS macos mysql nginx nodejs oauth2 podman python raspberry_pi shell socket telegram tools traefik 個人 資訊安全
Yiyu's Dev Blog
Yiyu's Dev Blog © 2025
皖ICP备17018037号 Hexo GeekMubai