Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const notes = [{
- },{
- title: 'My next trip',
- body:'I would like to go to Spain'
- },{
- title:'Habits to work on',
- body:'Exercise,.Eating a bit better'
- },{
- title: 'Office modification',
- body:'Get a new seat'
- }]
- //console.log(notes)
- const index = notes.findIndex(function(note, index) {
- return note.body === 'Exercise,.Eating a bit better'
- })
- //console.log(index)
- const findNote = function(notes, noteBody) {
- const index = notes.findIndex(function(note, index){
- return note.body.toLowerCase() === noteBody.toLowerCase()
- })
- return notes[index]
- }
- const note = findNote(notes,'Get a new seat')
- console.log(note)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement