Created
February 12, 2014 03:44
-
-
Save jsven69gist/8949732 to your computer and use it in GitHub Desktop.
JavaScript: assert()
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 characters
// Asserts expression | |
function assert(value, desc) { | |
var li = document.createElement('li'); | |
li.className = value ? 'pass' : 'fail'; // li css class must be created | |
li.appendChild(document.createTextNode(desc)); | |
document.getElementById('results').appendChild(li); // Assumes ul id is 'results' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment