Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
23
Task/Assertions/JavaScript/assertions.js
Normal file
23
Task/Assertions/JavaScript/assertions.js
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
function check() {
|
||||
try {
|
||||
if (isNaN(answer)) throw '$answer is not a number';
|
||||
if (answer != 42) throw '$answer is not 42';
|
||||
}
|
||||
catch(err) {
|
||||
console.log(err);
|
||||
answer = 42;
|
||||
}
|
||||
finally { console.log(answer); }
|
||||
}
|
||||
|
||||
console.count('try'); // 1
|
||||
let answer;
|
||||
check();
|
||||
|
||||
console.count('try'); // 2
|
||||
answer = 'fourty two';
|
||||
check();
|
||||
|
||||
console.count('try'); // 3
|
||||
answer = 23;
|
||||
check();
|
||||
Loading…
Add table
Add a link
Reference in a new issue