Something strange is happening with my code. I have a variable called racks_value that gets updated based on calculations performed on the page. Despite manually setting racks_value to 2 and confirming it with a console log, after running a series of IF statements, the value changes to 20 instead of staying at 2. You can test this by copying and pasting the code below into your browser's console.
I must be overlooking something simple in the code, as everything seems straightforward. Here's the code snippet:
var racks_value = 2;
console.log('racks value is ' + racks_value);
if (racks_value = 1){ var upfront_racks = 1000; }
if (racks_value = 2){ var upfront_racks = 2000; }
if (racks_value = 3){ var upfront_racks = 3000; }
if (racks_value = 4){ var upfront_racks = 4000; }
if (racks_value = 5){ var upfront_racks = 5000; }
// Rest of the IF statements...
console.log('racks value is ' + racks_value);
I've attempted changing = to ===, but it doesn't solve the issue. Adding another IF statement causes the second console log to display the new value rather than the expected one.