Well, I'm using something like a calculation library js
that I found, in this case I want to do something like a multiplication where they ask me for twoparámetros
(factor, valores_n)
where what I would do would be something like this:
So this is how I'm using it:
var multiplicacion = mult(factor , valores1 , ... valores_n)
factor
= the multiplier
valores_n
= the numbers I want to multiply
and the values I want to multiply are inside a array
,
var contenedor = [-5204.60, -3909.27, 2554.95 , 3390.40 , 2567.15 , 3986.73]
then this method does not allow to enter the valores_n
in array
the values must be so to speak "free".
target something like this:
var multiplicacion = mult(factor ,-5204.60, -3909.27, 2554.95 , 3390.40 , 2567.15 , 3986.73)
You can use
Function.prototype.apply( )
:As this function only works with arrays , if you want to use a value not present in the array , you will have to add it by hand :
If you can't modify the original container, you'll have to create another one.
You can use the
operador de propagación
, which saves you from fiddling with your array :