{"id":230506,"student_id":3469,"content":"var arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];\n\nshuffle(arr); // 將資料隨機打亂\nconsole.log(arr);\n// 若回傳小於0,a就會排在b的前面\n// 若回傳大於0,a就會排在b的後面\narr.sort(compare_asc);\nconsole.log(arr);\n\n\n// 由低到高排序\nfunction compare_asc (a, b) {\n return a - b;\n}\n\n// 由高到低排序\nfunction compare_desc (a, b) {\n return b - a;\n}\n\n\n\n","created_at":"2021-02-21T13:40:53.701+08:00","updated_at":"2021-02-21T13:55:30.782+08:00","name":"內建排序練習(1)預設版 副本","language":"javascript","screenshot":{"url":"https://cdn1.koding.school/uploads/project/screenshot/230506/fd1ac05835b665cf0d7e3c5532c7c2d7.jpg"},"parent_id":148158,"plugin":"function shuffle (arr) {\n for (var i=0; i\u003c1000; i++) {\n var rand1 = Math.floor(Math.random()*arr.length);\n var rand2 = Math.floor(Math.random()*arr.length);\n var tmp1 = arr[rand1];\n var tmp2 = arr[rand2];\n arr[rand1] = tmp2;\n arr[rand2] = tmp1;\n }\n return arr;\n}","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":85,"hashid":"2pds9ykjq","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":4133237,"file_name":"earth.png","project_id":230506,"asset_id":212453,"created_at":"2021-02-21T13:40:53.706+08:00","updated_at":"2021-02-21T13:40:53.706+08:00"},{"id":4133238,"file_name":"space_bg.jpg","project_id":230506,"asset_id":212454,"created_at":"2021-02-21T13:40:53.707+08:00","updated_at":"2021-02-21T13:40:53.707+08:00"},{"id":4133239,"file_name":"koding.png","project_id":230506,"asset_id":212455,"created_at":"2021-02-21T13:40:53.708+08:00","updated_at":"2021-02-21T13:40:53.708+08:00"},{"id":4133240,"file_name":"Gymnopedie_No_1.mp3","project_id":230506,"asset_id":212456,"created_at":"2021-02-21T13:40:53.709+08:00","updated_at":"2021-02-21T13:40:53.709+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦