daily pastebin goal
20%
SHARE
TWEET

callBack

a guest May 17th, 2018 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const notes = [{
  2. },{
  3.     title: 'My next trip',
  4.     body:'I would like to go to Spain'
  5. },{
  6.     title:'Habits to work on',
  7.     body:'Exercise,.Eating a bit better'
  8. },{
  9.     title: 'Office modification',
  10.     body:'Get a new seat'
  11. }]
  12.  
  13. //console.log(notes)
  14. const index = notes.findIndex(function(note, index) {
  15.     return note.body === 'Exercise,.Eating a bit better'
  16. })
  17. //console.log(index)
  18.  
  19. const findNote = function(notes, noteBody) {
  20.     const index = notes.findIndex(function(note, index){
  21.         return note.body.toLowerCase() === noteBody.toLowerCase()
  22.     })
  23.     return notes[index]
  24. }
  25. const note  = findNote(notes,'Get a new seat')
  26. console.log(note)
RAW Paste Data
Top