Completed exercises 05+06

This commit is contained in:
Roberra0 2023-06-20 09:45:30 -07:00
parent 1b6b1674d4
commit 06b4787e5b
5 changed files with 3745 additions and 2150 deletions

View File

@ -1,5 +1,5 @@
const helloWorld = function() {
return ''
return 'Hello, World!'
};
module.exports = helloWorld;

View File

@ -16,7 +16,7 @@ describe('sumAll', () => {
test('returns ERROR with non-number parameters', () => {
expect(sumAll(10, "90")).toEqual('ERROR');
});
test('returns ERROR with non-number parameters', () => {
tes('returns ERROR with non-number parameters', () => {
expect(sumAll(10, [90, 1])).toEqual('ERROR');
});
});

View File

@ -1,6 +1,18 @@
const leapYears = function() {
const leapYears = function(year) {
//
//Not Divisible by 100 && /4: leap year
//Div by 100 & 400, Y
if ( (year%100 != 0) && (year%4 == 0)){
return true;
}
else if ((year%100 == 0) && (year%400 == 0)){
return true;
}
return false;
};
console.log(leapYears(1997));
// Do not edit below this line
module.exports = leapYears;

View File

@ -4,19 +4,19 @@ describe('leapYears', () => {
test('works with non century years', () => {
expect(leapYears(1996)).toBe(true);
});
test.skip('works with non century years', () => {
test('works with non century years', () => {
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);
});
test.skip('works with century years', () => {
test('works with century years', () => {
expect(leapYears(1900)).toBe(false);
});
test.skip('works with century years', () => {
test('works with century years', () => {
expect(leapYears(1600)).toBe(true);
});
test.skip('works with century years', () => {
test('works with century years', () => {
expect(leapYears(700)).toBe(false);
});
});

5867
package-lock.json generated

File diff suppressed because it is too large Load Diff