I have the following file where the values assigned to two variables are stored; same that I export with module.exports
//archivo datos.js
const num1 = 12
const num2 = 22
module.exports = {
uno: num1,
dos: num2
}
Now in a separate file I receive those values that I want to use within a function to be able to add them and return their value
//archivo app.js
let op = require("./datos.js")
let numeroUno = op.uno
let numeroDos = op.dos
console.log(numeroUno + numeroDos)
If I do it in the previous way, accessing with the variable op and then a the desired key, I can do the sum without problems
However if I pass those variables inside a function I get an error of type NaN
//De este modo no me sale el ejercicio
let op = require("./datos.js")
let numeroUno = op.uno
let numeroDos = op.dos
function suma(numeroUno, numeroDos){
return numeroUno + numeroDos
}
console.log(suma())
The console error is NaN