Compare commits
No commits in common. "3faa9634ab26df90e5f73790eeba249d35cdf5ed" and "fe94193f9700914de2085a62d2dabdb56a57f209" have entirely different histories.
3faa9634ab
...
fe94193f97
|
@ -1,8 +1,5 @@
|
||||||
const getTheTitles = function(array) {
|
const getTheTitles = function() {
|
||||||
const titles = array.map((obj) => {
|
|
||||||
return obj.title;
|
|
||||||
})
|
|
||||||
return titles;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Do not edit below this line
|
// Do not edit below this line
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
const findTheOldest = function(array) {
|
const findTheOldest = function() {
|
||||||
const oldest = array.sort((a, b) => {
|
|
||||||
let yearNow = (new Date()).getFullYear();
|
|
||||||
let ageA = ((a.yearOfDeath) ? a.yearOfDeath : yearNow) - a.yearOfBirth;
|
|
||||||
let ageB = ((b.yearOfDeath) ? b.yearOfDeath : yearNow) - b.yearOfBirth;
|
|
||||||
return (ageA > ageB) ? -1 : 1;
|
|
||||||
})[0];
|
|
||||||
return oldest;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Do not edit below this line
|
// Do not edit below this line
|
||||||
|
|
|
@ -21,7 +21,7 @@ describe('findTheOldest', () => {
|
||||||
]
|
]
|
||||||
expect(findTheOldest(people).name).toBe('Ray');
|
expect(findTheOldest(people).name).toBe('Ray');
|
||||||
});
|
});
|
||||||
test('finds the person with the greatest age if someone is still living', () => {
|
test.skip('finds the person with the greatest age if someone is still living', () => {
|
||||||
const people = [
|
const people = [
|
||||||
{
|
{
|
||||||
name: "Carly",
|
name: "Carly",
|
||||||
|
@ -40,7 +40,7 @@ describe('findTheOldest', () => {
|
||||||
]
|
]
|
||||||
expect(findTheOldest(people).name).toBe('Ray');
|
expect(findTheOldest(people).name).toBe('Ray');
|
||||||
});
|
});
|
||||||
test('finds the person with the greatest age if the OLDEST is still living', () => {
|
test.skip('finds the person with the greatest age if the OLDEST is still living', () => {
|
||||||
const people = [
|
const people = [
|
||||||
{
|
{
|
||||||
name: "Carly",
|
name: "Carly",
|
||||||
|
|
Loading…
Reference in New Issue