GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

No menu could be recovered. Follow the blue links in the page.

This view

  • Original page
  • New address

GeezerVison is showing ja.javascript.info — 逆の順序でソートする

  • チュートリアル
  • JavaScript 言語
  • データ型
  • 配列のメソッド
レッスンに戻る

逆の順序でソートする

重要性: 4
let arr = [5, 2, 1, -10, 8];

// ... 逆順でソートをするあなたのコード

alert( arr ); // 8, 5, 2, 1, -10
let arr = [5, 2, 1, -10, 8];

arr.sort((a, b) => b - a);

alert( arr );
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.