This can be tricky: A variable defined with const can be compiled via Babel to a regular var and therefore a violation of this rule might not throw in a browser. However if this code isn't compiled and run directly with modern tools where const is natively supported, a ReferenceError will be thrown.
This can be tricky: A variable defined with
const
can be compiled via Babel to a regularvar
and therefore a violation of this rule might not throw in a browser. However if this code isn't compiled and run directly with modern tools whereconst
is natively supported, aReferenceError
will be thrown.https://eslint.org/docs/rules/no-use-before-define