0
What is wrong in my JavaScript program ?
When user inputs into second input box the second selection box automatically change to indian rupee code with error : https://code.sololearn.com/WGX36ZuyXKIa/# but when i changed the order of if else its started running as i want corrected code : https://code.sololearn.com/WslbM6Oj08ol/# tell me why my programming was not running as desired and why its running in second code.
3 Answers
+ 2
The problem is that first if statement is assigning value to s1 or s2 when there is an change to the value i1 or i2.
ex if(s1.value="RUP")... this if statement is considered to be true so it will assign "RUP" to the value of s1, instead of comparing the value of s1 to "RUP".
In this case you should be using "==" or "==="
To be clear all of the if and else if statements are set to assign a value instead of comparing values.
+ 2
You're welcome, glad I could help
+ 1
Thank You ODLNT.