有 3 筆資料符合您搜尋的條件

Leo145x
2023-09-25, 02:28
版面: Coding
主題: [JavaScript] Promise
回覆: 0
觀看: 5272

[JavaScript] Promise

在 JavaScript 時常會碰到非同步程式的狀況,大部份是與伺服器取得資料時會遇到, 以前只能用回乎函式來解決非同步程式碼的問題,但是回呼函式很難維護與閱讀,如下: getJSON("data/ninjas.json", function(err, ninjas){ getJSON(ninjas[0].location, function(err, locationInfo){ sendOrder(locationInfo, function(err, status){ /*Process status*/ }) }) }); JavaScript 在 ES6 導入 Promise,它可以...
Leo145x
2023-09-21, 04:16
版面: Coding
主題: [python] 將data寫入txt
回覆: 1
觀看: 2197

Re: [python] 將data寫入txt

代碼: 選擇全部

with open("file_name","w or r",encoding="UTF-8") as f:
// Should be give encoding.
Leo145x
2023-09-21, 03:59
版面: Coding
主題: [JavaScript] Using closure make private attribute
回覆: 0
觀看: 4056

[JavaScript] Using closure make private attribute

代碼: 選擇全部

function Leo(){
	let page;
	this.get_page = () =>{
		return page;
	}
}

let leo = new Leo();
console.log(leo.get_page);