ソートのアルゴリズムもやってみます。 まずはバブルソートです。 %%js //バブルソートで昇順に並べかえる const data = [8,5,2,4,7,3,1,9]; let arr = [...data]; function swap(array, idx1, idx2){ let tmp = array[idx1]; array[idx1] = array[idx2]; array[idx2] = tmp; } function bubbleSort(array){ let n = array.length; for(let i=0; i<n-1; i++){ for(let j=n…