Skip to content

Instantly share code, notes, and snippets.

View cplpearce's full-sized avatar
🙃
Riding the programming emotional roller coaster

lorem ipsum cplpearce

🙃
Riding the programming emotional roller coaster
View GitHub Profile
@cplpearce
cplpearce / kata4InstructorsNames.js
Last active March 1, 2024 17:31
Kata 4 - Instructors Names
const instructorWithLongestName = function(instructors) {
let longestName = "";
for (let i of instructors) {
i.name.length > longestName.length && (longestName = i.name);
}
return longestName;
};
console.log(instructorWithLongestName([
{name: "Samuel", course: "iOS"},
@cplpearce
cplpearce / kata3Vowels.js
Created August 8, 2020 02:41
Kata 3 - Vowels
const numberOfVowels = function(data) {
let count = 0;
for (let char of data) {
switch(char) {
case "a":
count++;
break;
case "e":
count++;
break;
@cplpearce
cplpearce / kata2ConditionalSums.js
Created August 8, 2020 02:32
Kata 2 - Conditional sums
const conditionalSum = function(values, condition) {
let total = 0;
for (let val of values) {
if (condition === "even") {
val % 2 === 0 ? total += val : total += 0;
} else if (condition === "odd") {
val % 2 !== 0 ? total += val : total += 0;
} else {
continue;
}