Skip to content

Commit 548d9ae

Browse files
authored
Shuffle an array
1 parent 4973415 commit 548d9ae

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,5 +213,17 @@ console.log(urlParams.append('active', '1')); // "?post=1234&action=edit&active=
213213
```
214214
215215
216+
# Shuffle an array
216217
217218
219+
```javascript
220+
const list = [1,2,3,4,5,6,7,8,9];
221+
const shuffle = list.sort(func);
222+
223+
function func(a,b){
224+
return 0.5 - Math.random();
225+
}
226+
227+
console.log(shuffle);
228+
```
229+

0 commit comments

Comments
 (0)