<commit_before>// Exercise 1: Javascript Functions are First Class

// Here is example code from the lesson.

// Example 7:

function countWhereTrue (numbers, predicate) {
    var i;
    var count = 0;
    for (i = 0; i < numbers.length; i++) {
        if (predicate(numbers[i])) {
            count++;
        }
    }
    return count;
}

function isOdd(number) {
    return (number % 2) === 1;
}

// And here is some code to test that the code above works correctly.

var inputNumbers = [3, 1, 6, 2, 4, 9, 7, 5];

if (countWhereTrue(inputNumbers, isOdd) === 4) {
  console.log('isOdd predicate works correctly');
} else {
  console.log('isOdd predicate does not work correctly');
}

// Rewrite the predicate isEven so that the following code works.
// Note that this, like the example above, is using a named function.

function isEven (number) {
  return false;
}<commit_msg>yet another bug<commit_after>// Exercise 1: Javascript Functions are First Class

// Here is example code from the lesson.

// Example 7:

function countWhereTrue (numbers, predicate) {
    var i;
    var count = 0;
    for (i = 0; i < numbers.length; i++) {
        if (predicate(numbers[i])) {
            count++;
        }
    }
    return count;
}

function isOdd(number) {
    return (number % 2) === 1;
}

// And here is some code to test that the code above works correctly.

var inputNumbers = [3, 1, 6, 2, 4, 9, 7, 5];

if (countWhereTrue(inputNumbers, isOdd) === 5) {
  console.log('isOdd predicate works correctly');
} else {
  console.log('isOdd predicate does not work correctly');
}

// Rewrite the predicate isEven so that the following code works.
// Note that this, like the example above, is using a named function.

function isEven (number) {
  return false;
}
{'fraction_non_alphanumeric': 0.11945392491467577, 'fraction_numerical': 0.017064846416382253, 'mean_word_length': 2.9886621315192743, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1322965', 'n_tokens_mistral': 596, 'n_tokens_neox': 539, 'n_words': 218}