2017-08-31 13 views
-4

Iは、以下を含むコードin this linkをまく:node.jsの変数意味の.end(data)とは何ですか?

クライアントはいくつかのオブジェクトの配列である
var client = clients.pop(); 
    client.end(//some data here)); 

変数の.end(..)の機能は何ですか?

ありがとうございました!

+2

こんにちは、あなたは追加のリンクがない変数 – DMan

+0

@DMan参照してください ' clients'はリクエストのリストなので、popを​​ポップアップして変数 'client'に格納すると、' client'_is_aのリクエストが返され、 '.end()'を呼び出すことができます。それは理にかなっていますか? – User31145

+0

の要求のためであるhttps://nodejs.org/api/http.html#http_request_end_data_encoding_callback – DMan

答えて

0

わかりやすくするために、解説する価値があるかもしれません。助け

// myObject, like client, is an object 
var myObject = { data: 123 }; 

// object slots are referenced by objectName.slotName 
// a new slot can be defined "on the fly" using this notation 
myObject.flurpies = function() { return 234; }; 

// myObject.flurpies, like client.end, points to a function 

// a function can be called by adding() following the function 

// this function call should return 234 
myObject.flurpies() 

希望...

関連する問題