Skip to content

Instantly share code, notes, and snippets.

View uzorjchibuzor's full-sized avatar

Chibuzor Efedigbue uzorjchibuzor

View GitHub Profile
function highestStreakInAnArray(result) {
let highStreak = 1,
currStreak = 1;
}
for (let i = 0; i < result.length; i++) {
if (result[i] === result[i + 1]) {
currStreak++;
if (currStreak > highStreak) {
highStreak = currStreak;
function chunkArrayInGroups(arr, size) {
// Break it up.
let chunks = arr.length/size;
let newArray = [];
for (let i = 0; i < chunks ; i++){
let chunkArray= arr.splice(0,size);
@uzorjchibuzor
uzorjchibuzor / fibonacci.js
Created June 25, 2018 22:16
Fibonacci Sequence with loop and with recursion
function fibonacci(num) {
let count = 1,
start = 0,
hold,
seq = [];
while (num >= 0) {
hold = count;
count = count + start;
start = hold;
@uzorjchibuzor
uzorjchibuzor / isogram.js
Created July 7, 2018 16:09
Function to determine whether a word is an isogram or not.
function isIsogram(check){
if (check) {
for (let i = 0; i < check.length; i++) {
for (let j = i + 1; j < check.length; j++) {
if (check[i] === check[j]) return false;
}
}
return true;
}
return 'Invalid Entry!'
// iterative solution
function pyramid(n) {
const midPoint = Math.floor((2 * n - 1) / 2);
for (let row = 0; row < n; row++) {
let level = "";
for (let column = 0; column < n * 2 - 1; column++) {
0 info it worked if it ends with ok
1 verbose cli [ '/home/chibuzor/.nvm/versions/node/v10.1.0/bin/node',
1 verbose cli '/home/chibuzor/.nvm/versions/node/v10.1.0/bin/npm',
1 verbose cli 'run',
1 verbose cli 'test' ]
2 info using npm@6.1.0
3 info using node@v10.1.0
4 verbose run-script [ 'pretest', 'test', 'posttest' ]
5 info lifecycle exercism-javascript@0.0.0~pretest: exercism-javascript@0.0.0
6 info lifecycle exercism-javascript@0.0.0~test: exercism-javascript@0.0.0