I am changing a global variable to the value of the input field in the HTML. I am then trying to take this value and use it inside another variable. However, this does not work, in console the value changes but not inside the variable opts. How do I make javascript pass this information successfully? Here is a link to jsfiddle where I have it running. I am trying to change the number of rays in this example: https://jsfiddle.net/9vdpt81n/
var loadValue = 1;
function val() {
newValue = document.getElementById("input").value;
loadValue = newValue;
}
val(opts);
var opts = {
rays: loadValue,
radiantSpan: loadValue,
}
console.logso we can run it and see what you mean.val()function but it doesn't expect one.valwith an argument when your function takes none?