0

I am attempting to change the value of an input into a different string, depending on if the inputed answer was "Yes" or "No". I have attempted to use ternary operators to clear up my code a little bit, but I keep getting original value ("Yes" or "No") instead of the value that the input should change into. I have the following code

function setYesNoValue(input, yes, no){
  input = input == "Yes" ? yes : no;
};
setYesNoValue(oneLInput, "517", "518");

The task I am attempting to perform works well when I use standard if else conditional statements, but I would like to implement this strategy to clear up the length code. Why isn't the value passed as the first argument changing when I reassign it?

Andrew Li
  • 55,805
  • 14
  • 125
  • 143
user7366442
  • 731
  • 2
  • 9
  • 16

0 Answers0