Title: Selection Sort in JavaScript - Runnable Code Snippet
Open Graph Title: Selection Sort in JavaScript - Runnable Code Snippet
X Title: Selection Sort in JavaScript - Runnable Code Snippet
Description: Sort an array using the selection sort algorithm by repeatedly finding the minimum element. Runnable JavaScript snippet with live execution.
Open Graph Description: Sort an array using the selection sort algorithm by repeatedly finding the minimum element. Runnable JavaScript snippet with live execution.
X Description: Sort an array using the selection sort algorithm by repeatedly finding the minimum element. Runnable JavaScript snippet with live execution.
Keywords:
Opengraph URL: https://tempercode.dev/snippets/selection-sort-javascript
Domain: tempercode.dev
{"@context":"https://schema.org","@type":"SoftwareSourceCode","name":"Selection Sort","description":"Sort an array using the selection sort algorithm by repeatedly finding the minimum element.","programmingLanguage":"JavaScript","text":"const a = [...arr];\nfor (let i = 0; i < a.length; i++) {\n let minIdx = i;\n for (let j = i + 1; j < a.length; j++) {\n if (a[j] < a[minIdx]) minIdx = j;\n }\n if (minIdx !== i) [a[i], a[minIdx]] = [a[minIdx], a[i]];\n}\nreturn a;"}
| theme-color | #0c0d12 |
| color-scheme | dark |
| author | Temper |
| creator | Temper |
| publisher | Temper |
| og:image | https://tempercode.dev/og-image.png |
| og:type | article |
| twitter:card | summary_large_image |
| twitter:image | https://tempercode.dev/og-image.png |
Links:
Viewport: width=device-width, initial-scale=1