html
html
1
2
3
4
5
6
7
8
9
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
</body>
</html>
Enter to Rename, Shift+Enter to Preview
css
css
1
2
3
4
5
pre {
font-size:2.5vw;
white-space:pre-wrap;
}
Enter to Rename, Shift+Enter to Preview
js
js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// https://www.sololearn.com/Discuss/2650251/?ref=app
/*
Shuffling JavaScript Array
Suppose I have an array like:
a = ['a', 'l', 'e', 'r', 't']
I need a function to shuffle that array without changing forgetting the index of the values.
Eg, this is the original array.
a = ['a', 'l', 'e', 'r', 't']
ar = a[0] + a[1] + a[2] + a[3] + a[4]
//ar = alert
After random shuffle of array values, it may look like:
a = ['t', 'e', 'a', 'r', 'l']
ar =a[2] + a[4] + a[1] + a[4] + a[0]
//ar = alert
Here, the value of "ar" should be same on every shuffle.
The function can return these 2 statements as a string, but not necessarily needed
*/
class Arr extends Array {
constructor(array) {
super();
array.forEach((v,i) => this[i] = {v,i});
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Run