Created
February 28, 2022 20:32
-
-
Save mogrady-professional/06f75defc6ac8c149392b42c98464f3a to your computer and use it in GitHub Desktop.
Revisions
-
mogrady-professional created this gist
Feb 28, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ const errorMsg = 'the # is not even'; for (let number = 2; number <= 5; number += 1) { console.log('the # is ' + number); console.assert(number % 2 === 0, {number: number, errorMsg: errorMsg}); // or, using ES2015 object property shorthand: // console.assert(number % 2 === 0, {number, errorMsg}); } // output: // the # is 2 // the # is 3 // Assertion failed: {number: 3, errorMsg: "the # is not even"} // the # is 4 // the # is 5 // Assertion failed: {number: 5, errorMsg: "the # is not even"}