async getaaa()
async getbbb()
async getccc()
=======new way=======
async refreshall(){
await Promise.all( xxxxxx.map(async (value, index) =>{
aaa = await getaaa()
}))
await Promise.all( xxxxxx.map(async (value, index) =>{
bbb = await getbbb()
}))
await Promise.all( xxxxxx.map(async (value, index) =>{
ccc = await getccc()
}))
}
=======old way=======
async refreshall(){
await Promise.all( xxxxxx.map(async (value, index) =>{
aaa = await getaaa()
bbb = await getbbb()
ccc = await getccc()
Problem: array A A.push(item) item is object from for or map or foreach….etc
show A all add item is same…….
Solve:
var txxxxx = [] // xxxx is any word
=====loop start=====
txxxx[index] = item //index is from for or map or foreach…etc
ot = {
xxxx: txxxx[index]
}
A.push(ot)
=====loop end=====
https://hackmd.io/s/Bko9gUGYZ
https://yami.io/reduce-foreach-filter-map/
http://www.javascriptkit.com/javatutors/preloadimagesplus.shtml
http://fragged.org/preloading-images-using-javascript-the-right-way-and-without-frameworks_744.html
http://note.tc.edu.tw/175.html
[radio 取值]
以下範例示範當使用者按下 submit ( id=sb1 ) 時的檢查動作,其中 radio 的 name=doway
$("#sb1").click(function(){
var method =$(“input[name=‘doway’]:checked”).val(); //radio 取值,注意寫法
if( typeof(method) == “undefined”){ // 注意檢查完全沒有選取的寫法,這行是精華
alert( “請選取操作方式!");
return false;
}
http://buzzorange.com/techorange/2015/08/18/humans-create-softwarehow-do-you-judge-a-javascript-programmer-by-only-5-questions/
Q1:你能解釋出什麼是 apply 函數嗎?
當之後你在建立 Library 時你一定要記得最常使用的 apply 函數
Q2:你能跟我解釋一下什麼是 map 嗎?不仿就再問問有關 reduce 方法。如果你不懂什麼是 map ,這代表著你在功能性撰寫程式程度是零!但千萬別放棄治療,建議你從這快開始你的學習之旅:A dirt simple introduction to higher order functions in JavaScript.
Q3:能解釋什麼是 bind 嗎?
Q4:解釋一下什麼是 closures ?