Nodejs 入門學習 (一) 定義變數

2021-10-25 17:12:04 字數 1048 閱讀 2751

宣告與未聲名變數的區別(** g)

//**a:

var name;

d name =

"nodejs"

;//**b:

name =

"nodejs"

;var name;

//**c:

functionx(

)x()

; console.

log(y)

;// '1'

console.

log(z)

;// referenceerror: z is not defined

//**d:

console.

log(a)

;// 丟擲referenceerror。

console.

log(

'still going...');

// 不會執行

//**e

var a;

console.

log(a)

;// "undefined"或""(不同執行引擎的實現不同)

console.

log(

'still going...');

// 'still going...'

//**f

var x =0;

functionf(

)f()

; console.

log(x)

;// 0

console.

log(y)

;// referenceerror: y is not defined

//** other1

console.

log(x)

;// 1

console.

log(y)

;// 1

//** other2

console.

log(x)

;// 1

const定義常量 定義後不能修改 應該和let 一樣是塊級變數。

Nodejs學習總結 Express入門(一)

express是基於node.js平台開發的web應用開發框架,下面我們入手學習。官網 github express生成器 1 生成express全域性指令 npm install express generator g 注 生成 express h可以檢視所有命令列選項 如上圖就是乙個expres...

NodeJs入門學習筆記

阻塞是按順序執行的。有先後順序。input.txt檔案內容是 我是阻塞varfs require fs vardata fs.readfilesync input.txt console.log data.tostring console.log 程式執行結束 輸出結果是 我是阻塞程式執行結束 而非...

nodeJs入門筆記 一

node將 http伺服器 這一層抽離,直接面向瀏覽器使用者 如php執行之前先要配置乙個功能強大而複雜的http 伺服器,譬如apache iis 或nginx,還需要將php 配置為http 伺服器的模組,或者使用fastcgi 協議呼叫php 直譯器。這種架構是 瀏覽器 http 伺服器 ph...