JS: add debug statement to accumulate