I have this function where I have 2 parameters, I use the "field" parameter to access an object but it takes it as an attribute of the object and does not refer to my parameter.
async id(modelo, campo){
const data = await modelo.all()
console.log(data)
var idmayor = 0
for (let i = 0; i < data.rows.length; i++) {
const id = data.rows[i].campo;
if(id > idmayor){
idmayor = id
}
console.log(idmayor)
}
idmayor + 1
return idmayor
}
Here it can be shown better that it does not refer to the parameter "field"
Thank you