Skip to content

Commit

Permalink
added try catch back into test_consts()
Browse files Browse the repository at this point in the history
  • Loading branch information
honzi committed Jun 21, 2024
1 parent 0f0e244 commit 9fa5385
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions js/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ function test_consts(args){
let results = '<tr class=header><td>Const<td>Value<td>Test';
for(const id in args['consts']){
const label = args['consts'][id];
const value = globalThis.eval(label);
const result = value !== void 0;
let result = false;
let value = '';
try{
value = eval(label);
result = value !== void 0;
}catch{}
results += '<tr ' + (!result ? ' style=background-color:#600' : '') + '>'
+ '<td>' + label
+ '<td>' + value
Expand Down

0 comments on commit 9fa5385

Please sign in to comment.