Find numbers that are both Triangle numbers and Square numbers
First, I tried to be mathematically clever (by trying something with the odd and evenness of triangular and square numbers). That resulted in me making a mistake and getting a bogus result.

Then I took a good look at your code. You are calling Math.sqrt for every iteration. That's really slow, so if we could work around that, it'd be a huge performance boost. And we can work around it, by keeping track of the next target to hit. 

Additionally, if we're gonna pass every integer anyway, why don't we add them as we go, rather than constantly recalculation triangle? A triangular number consists of all the whole positive integers at or below N, so by simply summing as we go, we can keep a calculated triangular number in memory without the need to recalculate every iteration.

The resulting code...

function main() {
var timer = Date.now();
  var triangleSum = 0;
  var productCounter = 1;
  var product = 1;
  for (var i = 1; i &lt; 100000000; i++) {
    triangleSum += i;
    if(triangleSum === product)
    {
        document.getElementById('log').innerHTML += '&lt;p&gt;' + Math.sqrt(triangleSum)+ ' and ' + i + ': ' + triangleSum + '&lt;/p&gt;';
    }
    if(triangleSum &gt;= product)
    {
        productCounter++;
        product = productCounter * productCounter;
    }
  }
  document.getElementById('log').innerHTML += '&lt;p&gt;&lt;b&gt;Time taken: ' + (Date.now() - timer) + ' milliseconds&lt;/b&gt;&lt;/p&gt;';
}


Runs in 380 ms compared to the 5346 ms it was giving me before.