I'm assembling the string as follows (my apology for not using the write markup; I can't find the instructions):
for (var k=3; k<template.length; k++) {
hint+= template[k] + '\n';
}
// Remove final newline character:
hint= hint.substring(0, hint.length-1);
Without the debug statements, the resulting string is missing some of the items that it should have included. When I add the window.alert statements, I get the correct result. It's been about a decade since I last encountered a situation where debugging changed the behavior of the code.
Phillip