This commit is contained in:
		
							parent
							
								
									cc086805b7
								
							
						
					
					
						commit
						e6e4540b32
					
				| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
const reverseString = function(str) {
 | 
					const reverseString = function(str) {
 | 
				
			||||||
    var newString = '';
 | 
					    let newString = '';
 | 
				
			||||||
    for (i = str.length -1; i >=0; i--) {
 | 
					    for (i = str.length -1; i>=0; i--) {
 | 
				
			||||||
        newString += str[i];
 | 
					        newString += str[i];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return newString;
 | 
					    return newString;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,11 @@
 | 
				
			||||||
const leapYears = function() {
 | 
					const leapYears = function(year) {
 | 
				
			||||||
 | 
					    if ( year % 100 === 0 && year % 400 != 0) {
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    } else if ( year % 4 === 0|| year % 400 === 0) {
 | 
				
			||||||
 | 
					        return true;
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,19 +4,20 @@ describe('leapYears', () => {
 | 
				
			||||||
  test('works with non century years', () => {
 | 
					  test('works with non century years', () => {
 | 
				
			||||||
    expect(leapYears(1996)).toBe(true);
 | 
					    expect(leapYears(1996)).toBe(true);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  test.skip('works with non century years', () => {
 | 
					  test('works with non century years', () => {
 | 
				
			||||||
    expect(leapYears(1997)).toBe(false);
 | 
					    expect(leapYears(1997)).toBe(false);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  test.skip('works with ridiculously futuristic non century years', () => {
 | 
					  test('works with ridiculously futuristic non century years', () => {
 | 
				
			||||||
    expect(leapYears(34992)).toBe(true);
 | 
					    expect(leapYears(34992)).toBe(true);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  test.skip('works with century years', () => {
 | 
					  test('works with century years', () => {
 | 
				
			||||||
    expect(leapYears(1900)).toBe(false);
 | 
					    expect(leapYears(1900)).toBe(false);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  test.skip('works with century years', () => {
 | 
					  test('works with century years', () => {
 | 
				
			||||||
    expect(leapYears(1600)).toBe(true);
 | 
					    expect(leapYears(1600)).toBe(true);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  test.skip('works with century years', () => {
 | 
					  test('works with century years', () => {
 | 
				
			||||||
    expect(leapYears(700)).toBe(false);
 | 
					    expect(leapYears(700)).toBe(false);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,9 +1,13 @@
 | 
				
			||||||
const ftoc = function() {
 | 
					const ftoc = function(f) {
 | 
				
			||||||
 | 
					  c = (f - 32) * (5/9);
 | 
				
			||||||
 | 
					  let rounded = Math.round(c * 10) / 10;
 | 
				
			||||||
 | 
					  return rounded;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const ctof = function() {
 | 
					const ctof = function(c) {
 | 
				
			||||||
 | 
					  f = (c * (9/5) + 32);
 | 
				
			||||||
 | 
					  let rounded = Math.round(f * 10) / 10;
 | 
				
			||||||
 | 
					  return rounded;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Do not edit below this line
 | 
					// Do not edit below this line
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,22 +4,22 @@ describe('ftoc', () => {
 | 
				
			||||||
  test('works', () => {
 | 
					  test('works', () => {
 | 
				
			||||||
    expect(ftoc(32)).toEqual(0);
 | 
					    expect(ftoc(32)).toEqual(0);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  test.skip('rounds to 1 decimal', () => {
 | 
					  test('rounds to 1 decimal', () => {
 | 
				
			||||||
    expect(ftoc(100)).toEqual(37.8);
 | 
					    expect(ftoc(100)).toEqual(37.8);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  test.skip('works with negatives', () => {
 | 
					  test('works with negatives', () => {
 | 
				
			||||||
    expect(ftoc(-100)).toEqual(-73.3);
 | 
					    expect(ftoc(-100)).toEqual(-73.3);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
describe('ctof', () => {
 | 
					describe('ctof', () => {
 | 
				
			||||||
  test.skip('works', () => {
 | 
					  test('works', () => {
 | 
				
			||||||
    expect(ctof(0)).toEqual(32);
 | 
					    expect(ctof(0)).toEqual(32);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  test.skip('rounds to 1 decimal', () => {
 | 
					  test('rounds to 1 decimal', () => {
 | 
				
			||||||
    expect(ctof(73.2)).toEqual(163.8);
 | 
					    expect(ctof(73.2)).toEqual(163.8);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  test.skip('works with negatives', () => {
 | 
					  test('works with negatives', () => {
 | 
				
			||||||
    expect(ctof(-10)).toEqual(14);
 | 
					    expect(ctof(-10)).toEqual(14);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,25 +1,49 @@
 | 
				
			||||||
const add = function() {
 | 
					const add = function(num1, num2) {
 | 
				
			||||||
 | 
					  let sum = num1 + num2;
 | 
				
			||||||
 | 
					  return sum;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const subtract = function(num1, num2) {
 | 
				
			||||||
 | 
					  let sum = num1 - num2;
 | 
				
			||||||
 | 
						return sum;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const sum = function(array) {
 | 
				
			||||||
 | 
					  let sum = 0;
 | 
				
			||||||
 | 
					  if (array.length > 0) {
 | 
				
			||||||
 | 
					  	for (i = 0; i < array.length; i++ ) {
 | 
				
			||||||
 | 
					      sum += array[i];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  } else {
 | 
				
			||||||
 | 
					    let sum = 0;
 | 
				
			||||||
 | 
					    return sum;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  return sum;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const multiply = function(array) {
 | 
				
			||||||
 | 
					  let sum = 1;
 | 
				
			||||||
 | 
					  for (i = 0; i < array.length; i++) {
 | 
				
			||||||
 | 
					    sum = sum * array[i];
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  return sum;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const subtract = function() {
 | 
					const power = function(num1, num2) {
 | 
				
			||||||
	
 | 
					  let sum = 1;
 | 
				
			||||||
 | 
						for (i = 0; i < num2; i++) {
 | 
				
			||||||
 | 
					    sum = sum * num1;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  return sum;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const sum = function() {
 | 
					const factorial = function(num) {
 | 
				
			||||||
	
 | 
					  let sum = 1;
 | 
				
			||||||
};
 | 
						for (i = num; i > 0; i--) {
 | 
				
			||||||
 | 
					    sum = sum * i;
 | 
				
			||||||
const multiply = function() {
 | 
					  }
 | 
				
			||||||
 | 
					  return sum;
 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const power = function() {
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const factorial = function() {
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Do not edit below this line
 | 
					// Do not edit below this line
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,73 +5,73 @@ describe('add', () => {
 | 
				
			||||||
		expect(calculator.add(0,0)).toBe(0);
 | 
							expect(calculator.add(0,0)).toBe(0);
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	test.skip('adds 2 and 2', () => {
 | 
						test('adds 2 and 2', () => {
 | 
				
			||||||
		expect(calculator.add(2,2)).toBe(4);
 | 
							expect(calculator.add(2,2)).toBe(4);
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	test.skip('adds positive numbers', () => {
 | 
						test('adds positive numbers', () => {
 | 
				
			||||||
		expect(calculator.add(2,6)).toBe(8);
 | 
							expect(calculator.add(2,6)).toBe(8);
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
describe('subtract', () => {
 | 
					describe('subtract', () => {
 | 
				
			||||||
	test.skip('subtracts numbers', () => {
 | 
						test('subtracts numbers', () => {
 | 
				
			||||||
		expect(calculator.subtract(10,4)).toBe(6);
 | 
							expect(calculator.subtract(10,4)).toBe(6);
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
describe('sum', () => {
 | 
					describe('sum', () => {
 | 
				
			||||||
	test.skip('computes the sum of an empty array', () => {
 | 
						test('computes the sum of an empty array', () => {
 | 
				
			||||||
		expect(calculator.sum([])).toBe(0);
 | 
							expect(calculator.sum([])).toBe(0);
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	test.skip('computes the sum of an array of one number', () => {
 | 
						test('computes the sum of an array of one number', () => {
 | 
				
			||||||
		expect(calculator.sum([7])).toBe(7);
 | 
							expect(calculator.sum([7])).toBe(7);
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	test.skip('computes the sum of an array of two numbers', () => {
 | 
						test('computes the sum of an array of two numbers', () => {
 | 
				
			||||||
		expect(calculator.sum([7,11])).toBe(18);
 | 
							expect(calculator.sum([7,11])).toBe(18);
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	test.skip('computes the sum of an array of many numbers', () => {
 | 
						test('computes the sum of an array of many numbers', () => {
 | 
				
			||||||
		expect(calculator.sum([1,3,5,7,9])).toBe(25);
 | 
							expect(calculator.sum([1,3,5,7,9])).toBe(25);
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
describe('multiply', () => {
 | 
					describe('multiply', () => {
 | 
				
			||||||
	test.skip('multiplies two numbers', () => {
 | 
						test('multiplies two numbers', () => {
 | 
				
			||||||
		expect(calculator.multiply([2,4])).toBe(8);
 | 
							expect(calculator.multiply([2,4])).toBe(8);
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	test.skip('multiplies several numbers', () => {
 | 
						test('multiplies several numbers', () => {
 | 
				
			||||||
		expect(calculator.multiply([2,4,6,8,10,12,14])).toBe(645120);
 | 
							expect(calculator.multiply([2,4,6,8,10,12,14])).toBe(645120);
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
describe('power', () => {
 | 
					describe('power', () => {
 | 
				
			||||||
	test.skip('raises one number to the power of another number', () => {
 | 
						test('raises one number to the power of another number', () => {
 | 
				
			||||||
		expect(calculator.power(4,3)).toBe(64); // 4 to third power is 64
 | 
							expect(calculator.power(4,3)).toBe(64); // 4 to third power is 64
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
describe('factorial', () => {
 | 
					describe('factorial', () => {
 | 
				
			||||||
	test.skip('computes the factorial of 0', () => {
 | 
						test('computes the factorial of 0', () => {
 | 
				
			||||||
		expect(calculator.factorial(0)).toBe(1); // 0! = 1
 | 
							expect(calculator.factorial(0)).toBe(1); // 0! = 1
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	test.skip('computes the factorial of 1', () => {
 | 
						test('computes the factorial of 1', () => {
 | 
				
			||||||
		expect(calculator.factorial(1)).toBe(1);
 | 
							expect(calculator.factorial(1)).toBe(1);
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	test.skip('computes the factorial of 2', () => {
 | 
						test('computes the factorial of 2', () => {
 | 
				
			||||||
		expect(calculator.factorial(2)).toBe(2);
 | 
							expect(calculator.factorial(2)).toBe(2);
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	test.skip('computes the factorial of 5', () => {
 | 
						test('computes the factorial of 5', () => {
 | 
				
			||||||
		expect(calculator.factorial(5)).toBe(120);
 | 
							expect(calculator.factorial(5)).toBe(120);
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	test.skip('computes the factorial of 10', () => {
 | 
						test('computes the factorial of 10', () => {
 | 
				
			||||||
		expect(calculator.factorial(10)).toBe(3628800);
 | 
							expect(calculator.factorial(10)).toBe(3628800);
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,18 @@
 | 
				
			||||||
const palindromes = function () {
 | 
					const palindromes = function (string) {
 | 
				
			||||||
 | 
					    let newString = '';
 | 
				
			||||||
 | 
					    // strip string of all puncuation and whitespace
 | 
				
			||||||
 | 
					    let cleanString = string.replace(/[.,\/#!$%\^&\*;:{}=\-_`~()\s+]/g, '');
 | 
				
			||||||
 | 
					    cleanString = cleanString.toLowerCase();
 | 
				
			||||||
 | 
					    // reverse string
 | 
				
			||||||
 | 
					    for (i = cleanString.length - 1; i>=0; i--) {
 | 
				
			||||||
 | 
					        newString += cleanString[i];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    // check if palindrome
 | 
				
			||||||
 | 
					    if (newString === cleanString) {
 | 
				
			||||||
 | 
					        return true;
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Do not edit below this line
 | 
					// Do not edit below this line
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,19 +4,19 @@ describe('palindromes', () => {
 | 
				
			||||||
  test('works with single words', () => {
 | 
					  test('works with single words', () => {
 | 
				
			||||||
    expect(palindromes('racecar')).toBe(true);
 | 
					    expect(palindromes('racecar')).toBe(true);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  test.skip('works with punctuation ', () => {
 | 
					  test('works with punctuation ', () => {
 | 
				
			||||||
    expect(palindromes('racecar!')).toBe(true);
 | 
					    expect(palindromes('racecar!')).toBe(true);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  test.skip('works with upper-case letters ', () => {
 | 
					  test('works with upper-case letters ', () => {
 | 
				
			||||||
    expect(palindromes('Racecar!')).toBe(true);
 | 
					    expect(palindromes('Racecar!')).toBe(true);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  test.skip('works with multiple words', () => {
 | 
					  test('works with multiple words', () => {
 | 
				
			||||||
    expect(palindromes('A car, a man, a maraca.')).toBe(true);
 | 
					    expect(palindromes('A car, a man, a maraca.')).toBe(true);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  test.skip('works with multiple words', () => {
 | 
					  test('works with multiple words', () => {
 | 
				
			||||||
    expect(palindromes('Animal loots foliated detail of stool lamina.')).toBe(true);
 | 
					    expect(palindromes('Animal loots foliated detail of stool lamina.')).toBe(true);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  test.skip('doesn\'t just always return true', () => {
 | 
					  test('doesn\'t just always return true', () => {
 | 
				
			||||||
    expect(palindromes('ZZZZ car, a man, a maraca.')).toBe(false);
 | 
					    expect(palindromes('ZZZZ car, a man, a maraca.')).toBe(false);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,5 @@
 | 
				
			||||||
 | 
					const outerArr = [];
 | 
				
			||||||
 | 
					const innerArr = [];
 | 
				
			||||||
 | 
					// outerArr.push(innerArr);
 | 
				
			||||||
 | 
					innerArr[0] = "hello";
 | 
				
			||||||
 | 
					console.log(outerArr);
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,5 @@
 | 
				
			||||||
 | 
					const outerArr = [];
 | 
				
			||||||
 | 
					const innerArr = [];
 | 
				
			||||||
 | 
					outerArr.push(innerArr);
 | 
				
			||||||
 | 
					innerArr[0] = "hello";
 | 
				
			||||||
 | 
					console.log(outerArr);
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,13 @@
 | 
				
			||||||
const fibonacci = function() {
 | 
					const fibonacci = function(Fn) {
 | 
				
			||||||
 | 
					    let fib = [0, 1];
 | 
				
			||||||
 | 
					    if (Fn >= 0) {
 | 
				
			||||||
 | 
					        for (i=2;i<=Fn;i++) {
 | 
				
			||||||
 | 
					            fib[i] = fib[i-2] + fib[i-1];
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        return 'OOPS'
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return fib[Fn];
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Do not edit below this line
 | 
					// Do not edit below this line
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,28 +4,28 @@ describe('fibonacci', () => {
 | 
				
			||||||
  test('4th fibonacci number is 3', () => {
 | 
					  test('4th fibonacci number is 3', () => {
 | 
				
			||||||
    expect(fibonacci(4)).toBe(3);
 | 
					    expect(fibonacci(4)).toBe(3);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  test.skip('6th fibonacci number is 8', () => {
 | 
					  test('6th fibonacci number is 8', () => {
 | 
				
			||||||
    expect(fibonacci(6)).toBe(8);
 | 
					    expect(fibonacci(6)).toBe(8);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  test.skip('10th fibonacci number is 55', () => {
 | 
					  test('10th fibonacci number is 55', () => {
 | 
				
			||||||
    expect(fibonacci(10)).toBe(55);
 | 
					    expect(fibonacci(10)).toBe(55);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  test.skip('15th fibonacci number is 610', () => {
 | 
					  test('15th fibonacci number is 610', () => {
 | 
				
			||||||
    expect(fibonacci(15)).toBe(610);
 | 
					    expect(fibonacci(15)).toBe(610);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  test.skip('25th fibonacci number is 75025', () => {
 | 
					  test('25th fibonacci number is 75025', () => {
 | 
				
			||||||
    expect(fibonacci(25)).toBe(75025);
 | 
					    expect(fibonacci(25)).toBe(75025);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  test.skip('doesn\'t accept negatives', () => {
 | 
					  test('doesn\'t accept negatives', () => {
 | 
				
			||||||
    expect(fibonacci(-25)).toBe("OOPS");
 | 
					    expect(fibonacci(-25)).toBe("OOPS");
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  test.skip('DOES accept strings', () => {
 | 
					  test('DOES accept strings', () => {
 | 
				
			||||||
    expect(fibonacci("1")).toBe(1);
 | 
					    expect(fibonacci("1")).toBe(1);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  test.skip('DOES accept strings', () => {
 | 
					  test('DOES accept strings', () => {
 | 
				
			||||||
    expect(fibonacci("2")).toBe(1);
 | 
					    expect(fibonacci("2")).toBe(1);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  test.skip('DOES accept strings', () => {
 | 
					  test('DOES accept strings', () => {
 | 
				
			||||||
    expect(fibonacci("8")).toBe(21);
 | 
					    expect(fibonacci("8")).toBe(21);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,9 @@
 | 
				
			||||||
const getTheTitles = function() {
 | 
					const getTheTitles = function(array) {
 | 
				
			||||||
 | 
					    let titles = [];
 | 
				
			||||||
 | 
					    for (i=0;i<array.length;i++) {
 | 
				
			||||||
 | 
					        titles[i] = array[i].title;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return titles;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Do not edit below this line
 | 
					// Do not edit below this line
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,3 +6,8 @@ Given an array of objects representing people with a birth and death year, retur
 | 
				
			||||||
- You should return the whole person object, but the tests mostly just check to make sure the name is correct.
 | 
					- You should return the whole person object, but the tests mostly just check to make sure the name is correct.
 | 
				
			||||||
- this can be done with a couple of chained array methods, or by using `reduce`.
 | 
					- this can be done with a couple of chained array methods, or by using `reduce`.
 | 
				
			||||||
- One of the tests checks for people with no death-date.. use JavaScript's Date function to get their age as of today.
 | 
					- One of the tests checks for people with no death-date.. use JavaScript's Date function to get their age as of today.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Compare the ages to each other (yearOfBirth - yearOfDeath)
 | 
				
			||||||
 | 
					Then return name of oldest person
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,5 @@
 | 
				
			||||||
const findTheOldest = function() {
 | 
					const findTheOldest = function(arry) {
 | 
				
			||||||
 | 
					    let deathYear = arry
 | 
				
			||||||
 | 
					
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,18 @@
 | 
				
			||||||
const caesar = function() {
 | 
					const caesar = function(string, offSet) {
 | 
				
			||||||
 | 
					    let uniNum = 0;
 | 
				
			||||||
 | 
					    let shiftedNum = 0;
 | 
				
			||||||
 | 
					    let shiftedString = '';
 | 
				
			||||||
 | 
					    for (i=0;i<string.length;i++) {
 | 
				
			||||||
 | 
					        uniNum = string.charCodeAt(i);   // Get unicode num
 | 
				
			||||||
 | 
					        if (uniNum >= 65 && uniNum <= 90 || uniNum >= 97 && uniNum <= 122) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            shiftedNum = uniNum + offSet    ;    // Shift unicode
 | 
				
			||||||
 | 
					            shiftedString += String.fromCharCode(shiftedNum);    // Converts back to character
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            shiftedString += string[i];  // Change Nothing
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return shiftedString;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Do not edit below this line
 | 
					// Do not edit below this line
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,10 +3,10 @@ const caesar = require('./caesar')
 | 
				
			||||||
test('works with single letters', () => {
 | 
					test('works with single letters', () => {
 | 
				
			||||||
  expect(caesar('A', 1)).toBe('B');
 | 
					  expect(caesar('A', 1)).toBe('B');
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
test.skip('works with words', () => {
 | 
					test('works with words', () => {
 | 
				
			||||||
  expect(caesar('Aaa', 1)).toBe('Bbb');
 | 
					  expect(caesar('Aaa', 1)).toBe('Bbb');
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
test.skip('works with phrases', () => {
 | 
					test('works with phrases', () => {
 | 
				
			||||||
  expect(caesar('Hello, World!', 5)).toBe('Mjqqt, Btwqi!');
 | 
					  expect(caesar('Hello, World!', 5)).toBe('Mjqqt, Btwqi!');
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
test.skip('works with negative shift', () => {
 | 
					test.skip('works with negative shift', () => {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue