Skip to content

Instantly share code, notes, and snippets.

@tylerpeterson
Created September 27, 2018 15:42
Show Gist options
  • Save tylerpeterson/b68b12ba846f59f6d6c43bf143de963b to your computer and use it in GitHub Desktop.
Save tylerpeterson/b68b12ba846f59f6d6c43bf143de963b to your computer and use it in GitHub Desktop.
2017-06-15-08-47-11 sample
<!-- a bunch of markup -->
<!-- a bunch of markup -->
<p>The count is <span id="result">blah</span></p>
<!-- a bunch of markup -->
<!-- a bunch of markup -->
<!-- a bunch of markup -->
<!-- a bunch of markup -->
function countItems(arr) {
var i;
var count = 0;
for (i = 0; i < arr.length; ++i) {
if (arr[i] % 3 === 0) {
count++;
}
}
return count;
}
// Glue Code
document.getElementById('result').innerHTML = countItems([3]);
// fin.
#result {
color: red;
font-weight: bold;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment