Giter Site home page Giter Site logo

learn-node.js's Introduction

Learn Node.js

nvm-window

nvm list  //列出現有下載的
nvm available //列出可以用的
nvm list available//列出可以用的
nvm install latest //最新版本
nvm install lts //LTS版本
nvm use xx.xx.xx //使用指定版本號
nvm uninstall xx.xx.xx //刪除指定版本node版本

REPL (Read-Eval-Print Loop)

簡單的、可互動的編輯程式語言的環境,可以在上面執行程式。瀏覽器的console可以視為一個REPL。

Node 傳遞參數

//index.js
console.log(process.argv)

//cmd
node index.js wyatt age=23

Console

console.clear()清空
console.trace()追蹤程式執行路徑

Globals

特別的全局對象

不是Node的REPL可以讀取到的,實際上是每一個模組裡面都有的。

  • __dirname
  • __filename
  • exports
  • module
  • require()

常見的全局對象

  • process
    • Node的運行環境、參數訊息等。
  • console
  • 定時器函數
    • setTimeout(callback, delay[,...args])
      • callback在delay毫秒後執行一次
    • setInterval(callback, delay[,...args])
      • callback在delay毫秒後重複執行一次
    • setImmediate(callback, delay[,...args])
      • callback I/O事件後的回調立即執行
    • process.nextTick(callback[,...args])
      • 添加到下一個Tick中
  • global

learn-node.js's People

Contributors

lazywyatt avatar lazyhcchen avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.