File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 3434
3535 // Array.prototype.every() // is everyone 19 or older?
3636
37+ const ageCheck = people . every ( person =>
38+ ( ( new Date ( ) ) . getFullYear ( ) ) - person . year >= 19 ) ;
39+
40+ let groupOk = '<div id = "message">Group is OK</div>' ;
41+ let groupNotOk = '<div id = "message">Group is not OK</div>' ;
42+
43+ /*verifyGroup = ageCheck ? document.getElementbyId("body").innerHTML = groupOk : document.getElementbyId("body").innerHTML = groupNotOk;
44+
45+ document.body.appendChild(document.createTextNode(verifyGroup));*/
46+
47+ console . log ( ageCheck ) ;
48+
3749 // Array.prototype.find()
3850 // Find is like filter, but instead returns just the one you are looking for
3951 // find the comment with the ID of 823423
4052
53+ const comment = comments . find ( comment =>
54+ comment . id === 823423
55+ ) ;
56+
57+ console . log ( comment ) ;
58+
4159 // Array.prototype.findIndex()
4260 // Find the comment with this ID
4361 // delete the comment with the ID of 823423
4462
63+ const index = comments . findIndex ( comment =>
64+ comment . id === 823423 ) ;
65+
66+ comments . splice ( index , 1 ) ;
67+
4568 </ script >
4669</ body >
4770</ html >
You can’t perform that action at this time.
0 commit comments