The JavaScript strict mode-only exception "for-in loop head declarations may not have initializers" occurs when the head of a for...in contains an initializer expression, such as for (var i = 0 in obj)
. This is not allowed in for-in loops in strict mode. In addition, lexical declarations with initializers like for (const i = 0 in obj)
are not allowed outside strict mode either.