Fixed #21347 -- Added missing JS variable declaration.

Thanks szymon.barglowski at gmail.com for the report.