File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 2828 // Array.prototype.some() // is at least one person 19 or older?
2929 // Array.prototype.every() // is everyone 19 or older?
3030
31+ console . log ( 'is at least one person 19 or older? The anwer is: ' + people . some ( kid => ( 2017 - kid . year > 18 ) ) ) ;
32+ console . log ( 'is everyone 19 or older? The anwer is: ' + people . every ( kid => ( 2017 - kid . year > 18 ) ) ) ;
33+
3134 // Array.prototype.find()
3235 // Find is like filter, but instead returns just the one you are looking for
3336 // find the comment with the ID of 823423
37+ let txt = comments . find ( comment => comment . id === 823423 ) . text ;
38+ console . log ( txt ) ;
3439
3540 // Array.prototype.findIndex()
3641 // Find the comment with this ID
3742 // delete the comment with the ID of 823423
43+ let idx = comments . findIndex ( comment => comment . id === 823423 ) ;
44+ console . log ( 'the index of the id 823423 is ' + idx ) ;
45+ let comments_new = [
46+ ...comments . slice ( 0 , idx ) ,
47+ ...comments . slice ( idx + 1 )
48+ ]
49+
50+ let newResult = [ ] ;
51+ comments_new . map ( i => newResult . push ( i . text ) )
52+ console . log ( 'after delete it, the comments are [' + newResult . join ( ', ' ) + '] now' ) ;
53+
3854
3955 </ script >
4056</ body >
Original file line number Diff line number Diff line change 10104 . [x] ~~ Array Cardio, Day 1~~
11115 . [x] ~~ Flex Panel Gallery~~
12126 . [x] ~~ Type Ahead~~
13- 7 . [ ] Array Cardio, Day 2
13+ 7 . [x] ~~ Array Cardio, Day 2~~
14148 . [ ] Fun with HTML5 Canvas
15159 . [ ] Dev Tools Domination
161610 . [ ] Hold Shift and Check Checkboxes
You can’t perform that action at this time.
0 commit comments