{"id":128808,"student_id":1998,"content":"/*****************************************************\n練習一\n*****************************************************/\nvar arr = [3, 6, 2, 8, 1, 5, 0, 7, 9, 4];\n\nconsole.log('排序後:' + arr);\narr.sort(function (a, b) {\n return a - b;\n});\nconsole.log('排序前:' + arr);\n\n\n\n/*****************************************************\n練習二\n*****************************************************/\n// 目標:將年紀從小排到大並印出\nvar students = [{\n name: '大衛', age: 24\n},\n {\n name: '莉莉', age: 17\n },\n {\n name: '艾蓮', age: 18\n },\n {\n name: '阿伯', age: 30\n },\n {\n name: '威廉', age: 23\n },\n {\n name: '凱文', age: 15\n },\n {\n name: '朵莉絲', age: 22\n }];\n\nconsole.log('排序前:' + JSON.stringify(students, null, 4));\n\nstudents.sort(function(a, b) {\n return a.age - b.age;\n})\nconsole.log('排序後:' + JSON.stringify(students, null, 4));\nvar quiz1 = [4, 5, 6, 2, 5, 2, 3]\n\nconsole.log('排序前:' + quiz1);\nquiz1.sort(function (a, b) {\n return a - b;\n});\nconsole.log('排序後:' + quiz1\n);\nvar quiz2 = [{\n a: 87, b: 35\n}, {\n a: 11, b: 25\n}, {\n a: 44, b: 21\n}]\nconsole.log('排序前:' + JSON.stringify(quiz2, null, 4));\n\nquiz2.sort(function(a, b){\n return a.a - b.a\nconsole.log('排序後:' + JSON.stringify(quiz2, null, 4));\n})","created_at":"2020-02-22T16:17:01.644+08:00","updated_at":"2020-03-06T22:05:12.077+08:00","name":"內建排序練習 副本","language":"javascript","screenshot":{"url":"https://cdn1.koding.school/uploads/project/screenshot/128808/89edcce60b8890776f43b51e69f48ea4.jpg"},"parent_id":31717,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":56,"hashid":"d5ms45vj","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":2213554,"file_name":"1.wav","project_id":128808,"asset_id":10,"created_at":"2020-02-22T16:17:01.648+08:00","updated_at":"2020-02-22T16:17:01.648+08:00"},{"id":2213555,"file_name":"0.wav","project_id":128808,"asset_id":9,"created_at":"2020-02-22T16:17:01.649+08:00","updated_at":"2020-02-22T16:17:01.649+08:00"},{"id":2213556,"file_name":"2.png","project_id":128808,"asset_id":8,"created_at":"2020-02-22T16:17:01.650+08:00","updated_at":"2020-02-22T16:17:01.650+08:00"},{"id":2213557,"file_name":"1.svg","project_id":128808,"asset_id":7,"created_at":"2020-02-22T16:17:01.651+08:00","updated_at":"2020-02-22T16:17:01.651+08:00"},{"id":2213558,"file_name":"0.png","project_id":128808,"asset_id":6,"created_at":"2020-02-22T16:17:01.652+08:00","updated_at":"2020-02-22T16:17:01.652+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦