Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strange Javascript statement

Tags:

javascript

if (1) {
  google_conversion_value = 1;
}

What is the meaning of the above statement? I mean, this looks like it will always execute so why bother with the if statement?

updated: one reason might be remnants of scripting on the server side. Any other ideas?

updated2: could as easily change the value of the assignment without bothering with the if statement, no?

like image 936
jldupont Avatar asked May 12 '11 12:05

jldupont


1 Answers

There are two likely explanations:

  1. It's a leftover from debugging.
  2. The file containing this code is generated dynamically and the original sourcecode contains something like if(<?php echo $some_stuff_enabled; ?>)

However, in the latter case it would have been cleaner to output that code block only if the condition is met - but maybe it's used in some crappy template engine that just allows replacements but no conditionals...

like image 120
ThiefMaster Avatar answered Oct 04 '22 23:10

ThiefMaster