+ 1

How i do for pass this ternary operation to a function?

How i do for pass this ternary operation to a function with the arguments: T1[0] and T1[1]: (T1[0] === "") ? (T1[0] = Nota, T1[1] = true):(T1[0] = parseFloat(T1[0]), T1[1] = false, (!(Data <= 5.0 && Data >= 0.0)) ? (throw new Error("Error, el valor ingresado no es válido. Por favor revisa las condiciones de entrada de datos para solucionar este error.")):; thanks :D

22nd Feb 2018, 2:33 AM
Emmanuel David Angarita Quintanilla
Emmanuel David Angarita Quintanilla - avatar
1 Resposta
+ 2
Not sure the context of this code, so I can't say in your specific example. But in general, a ternary operator can be used to determine the argument at runtime so if I have a function f(argument1) I could call it with a statement like f( condittion == true ? Obj1 : Obj2 ); Obj1 will be passed in if condition is true, otherwise Obj2 will be passed. Hope this helps
10th Mar 2018, 9:40 PM
Sean Patrick Franklin
Sean Patrick Franklin - avatar