forked from FS-Moringa/phase-1-array-find-method-lab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
71 lines (70 loc) · 2.46 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// code your solution here
// Define the variable record which stores an array of a superbowl win in 2015.
const record = [
{ year: "2018", result: "N/A"},
{ year: "2017", result: "N/A"},
{ year: "2016", result: "N/A"},
{ year: "2015", result: "W"},
{ year: "2014", result: "N/A"},
{ year: "2013", result: "L"},
{ year: "2012", result: "N/A"},
{ year: "2011", result: "N/A"},
{ year: "2010", result: "N/A"},
{ year: "2009", result: "N/A"},
{ year: "2008", result: "N/A"},
{ year: "2007", result: "N/A"},
{ year: "2006", result: "N/A"},
{ year: "2005", result: "N/A"},
{ year: "2004", result: "N/A"},
{ year: "2003", result: "N/A"},
{ year: "2002", result: "N/A"},
{ year: "2001", result: "N/A"},
{ year: "2000", result: "N/A"},
{ year: "1999", result: "N/A"},
{ year: "1998", result: "W"},
{ year: "1997", result: "W"},
{ year: "1996", result: "N/A"},
{ year: "1995", result: "N/A"},
{ year: "1994", result: "N/A"},
{ year: "1993", result: "N/A"},
{ year: "1992", result: "N/A"},
{ year: "1991", result: "N/A"},
{ year: "1990", result: "N/A"},
{ year: "1989", result: "L"},
{ year: "1988", result: "N/A"},
{ year: "1987", result: "L"},
{ year: "1986", result: "L"},
{ year: "1985", result: "N/A"},
{ year: "1984", result: "N/A"},
{ year: "1983", result: "N/A"},
{ year: "1982", result: "N/A"},
{ year: "1981", result: "N/A"},
{ year: "1980", result: "N/A"},
{ year: "1979", result: "N/A"},
{ year: "1978", result: "N/A"},
{ year: "1977", result: "N/A"},
{ year: "1976", result: "L"},
{ year: "1975", result: "N/A"},
{ year: "1974", result: "N/A"},
{ year: "1973", result: "N/A"},
{ year: "1972", result: "N/A"},
{ year: "1971", result: "N/A"},
{ year: "1970", result: "N/A"},
{ year: "1969", result: "N/A"},
{ year: "1968", result: "N/A"},
{ year: "1967", result: "N/A"},
{ year: "1966", result: "N/A"},
{ year: "1965", result: "N/A"},
{ year: "1964", result: "N/A"},
{ year: "1963", result: "N/A"},
{ year: "1962", result: "N/A"},
{ year: "1961", result: "N/A"},
{ year: "1960", result: "N/A"}
];
// Declare the function superbowlWin(record)
function superbowlWin(record){
// Return undefined if our record has no win objects
// Return the year Denver Broncos won the superbowl
const win = record.find(record => record.result === 'W')
return win ? win.year : undefined
}