简体   繁体   中英

Why is my argument not being recognized when I use it inside the function

const notes = require('./getNotes')
// gets notes in Object format


// function to create new note
const createNote = ( noteTitle, message, notes) => {
  notes.noteTitle = message
  return notes
}


module.exports = createNote

I am having trouble understanding the reason that this code is not letting my pass in my own argument for the noteTitle. It is very frustrating. Could someone provide a basic explanation of why things are going wrong and what an alternative method might work well and why that method works in comparison to this one. Thanks

scopes, the function body will replace the outside notes with the parameter, either give the notes constant a new name or the function parameter a new name

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM