Skip to content

Instantly share code, notes, and snippets.

View pinchez254's full-sized avatar
💻
Stop saying and start doing

Peter Mugendi pinchez254

💻
Stop saying and start doing
View GitHub Profile
@pinchez254
pinchez254 / score.js
Last active November 27, 2022 23:14
Given an array of integers, keep a total score based on the following; 1. Add 1 point for every even number in an array. 2. Add 3 points for every number in the array. 3 Add 5 points for every time you encounter 5 in the array. leave a star if this helped you
export function find_total( my_numbers ) {
//Insert your code here
let score = 0
my_numbers.forEach((x)=>{
if(x%2==0){
score = score + 1
}else if(x % 2 != 0 && x !== 5){
score = score + 3
}else{
@pinchez254
pinchez254 / semantic-commit-messages.md
Last active August 2, 2023 03:20
simple semantic commit messages for productivity

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@pinchez254
pinchez254 / FizzBuzz.js
Last active July 31, 2019 09:39
solving Fizz Buzz with JavaScript. Task: Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.
// fizz buzz
for (a=1 ; a < 101 ; a ++){
a % 15 == 0
? console.log('fizzBuzz')
: a % 3 === 0
? console.log('fizz')
: a % 5 === 0
? console.log('Buzz')
: console.log(a)
}