-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheckValidSyntax.js
54 lines (47 loc) · 1.14 KB
/
checkValidSyntax.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
// https://developers.google.com/apps-script/guides/v8-runtime
// Executing checkValidSyntax provides information about JS features currently supported
function tertiaryExp(a) {
return a || 'b';
}
function stringLiteral() {
const a = 'world';
return `Hello ${a}`;
}
function logicalOperators(fruit) {
return fruit || 'orange';
}
function arrForEach(arr) {
const _arr = [];
arr.forEach(el => _arr.push(el + el));
return _arr;
}
function whichEcma() {
const ecma = {
es6: {},
es100: {}
};
let k;
try {
k = new Map();
ecma.es6.supported = true;
} catch (err) {
ecma.es6.supported = false;
}
try {
k = new HashMap();
ecma.es100.supported = true;
} catch (err) {
ecma.es100.supported = false;
}
return ecma;
}
function checkValidSyntax() {
const a = tertiaryExp('a');
const b = tertiaryExp(); // work
const hello = stringLiteral(); // work
const hey = 'hey'; // 'let' declaration works
const fruit = logicalOperators(); // work
const ecma = whichEcma(); // es6 suported, es100 not supported
const arr = arrForEach([1, 2, 'a']); // works
var debug = 1; // add a breakpoint to this line
}