-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
56 lines (32 loc) · 1.34 KB
/
test.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
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
//https://stackoverflow.com/questions/2449182/getter-setter-on-javascript-array
// var arr = new Proxy(Array(100).fill(null), {
// get: (target, name) => { if (name < 1 || name >= 101) throw(`Out of bounds`); else return target[name-1] },
// set: (target, name, value) => { if (name < 1 || name >= 101) throw(`Out of bounds`); target[name-1] = value },
// });
// arr[0] = "defined"
// arr[0]
// arr[100] = "Hehe"
// console.log(arr[100])
// console.log(Object.keys(arr).length)
// arr [5] = require('prompt-sync')()()*1;
// arr [6] = require('prompt-sync')()()*1;
// const Arr = (min, max, arrName, fills=null) => {
// return new Proxy(Array(max - min + 1).fill(fills), {
// get: (target, name) => { if (name < min || name > max) throw (`${arrName} out of bounds`); return target[name - min] },
// set: (target, name, value) => { if (name < min || name > max) throw (`${arrName} out of bounds`); target[name - min] = value }
// });
// }
// let my2DArr = Arr(0,9,"my1DArr",Arr(0,9,"my2DArr"));
// // console.log([Object.keys(my2DArr).length, Object.keys(my2DArr[0]).length])
// my2DArr[0][0] = "Not a null value"
// console.log(my2DArr[0])
// my2DArr[-1][9] = "something else"
// console.log(LCASE('a'))
// console.log(LCASE('B'))
// console.log(LCASE('an'))
try {
throw("something")
} catch (e) {
let lineNumber =
console.log(e)
}