Class Name binding

suggest change

ClassDeclaration’s Name is bound in different ways in different scopes -

  1. The scope in which the class is defined - let binding
  2. The scope of the class itself - within \{ and \} in class {} - const binding
class Foo {
  // Foo inside this block is a const binding
}
// Foo here is a let binding

For example,

class A {
  foo() {
    A = null; // will throw at runtime as A inside the class is a `const` binding
  }
}
A = null; // will NOT throw as A here is a `let` binding

This is not the same for a Function -

function A() {
  A = null; // works
}
A.prototype.foo = function foo() {
  A = null; // works
}
A = null; // works

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Classes:
* Syntax
* Class Name binding

Table Of Contents
11 Arrays
12 Objects
14 Classes
16 Map
17 Set
24 Loops
27 Date
29 Scope
30 AJAX
35 Cookies
41 JSON
44 Fetch
45 Modules
46 Screen
64 Console
68 Symbols
73 Modals
76 Events
86 Proxy
89 WeakMap
90 WeakSet
102 Tilde