-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
61 lines (48 loc) · 1.24 KB
/
index.html
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<script type="module">
import * as turboprop from "./turboprop.js"
const getThese = turboprop.initialise()
getThese.push(1,[2,3],4)
const str = "Jonathan"
const arr = [...str]
const keys = turboprop.initialise(['a', 'd', 'e'])
const obj = {
a: 123,
b: 'frog',
c: null,
d: [5,5],
e: {a:1}
}
console.log(str[getThese])
console.log(arr[getThese])
console.log(arr[turboprop.initialise([0,1,2,3,5])])
console.log(obj[keys])
console.log(obj[turboprop.initialise(['c'])])
console.log(Array.isArray(getThese))
console.log("Initialising globally...")
turboprop.initialiseGlobally()
console.log("Hello!"[[1,2,5]])
const jonObj = {a: 3}
console.log(jonObj) // {a: 3}
jonObj[['b', 'c']] = ['Hello', 'World']
console.log(jonObj) // {a: 3, b: 'Hello', c: 'World'}
const jonArr = [1, 2, 3]
console.log(jonArr) // [1, 2, 3]
jonArr[[0, 2]] = [4, 0]
console.log(jonArr) // [4, 2, 0]
// strings are immutable, so this won't work
const jonStr = "Jon"
console.log(jonStr)
jonStr[[0, 2]] = ['N', 'k']
console.log(jonStr)
// does not break casting arrays to number
console.log(Number([1]))
</script>
</body>
</html>