Very good, I have a form in which to accept, I have to pass the content of 5 fields to a function, my question is: Is there any way a little more efficient to pass 5 variables to a function? Maybe Json? Thank you very much
Very good, I have a form in which to accept, I have to pass the content of 5 fields to a function, my question is: Is there any way a little more efficient to pass 5 variables to a function? Maybe Json? Thank you very much
When you have many variables it is more comfortable that you create an object and pass it as a parameter directly.
Here is a simple example:
var obj = {
valor1 : 1,
valor2 : 2,
valor3 : 3,
valor4 : 4,
valor5 : 5
}
function Ejemplo(objeto) {
console.log(objeto.valor2);
}
Ejemplo(obj);