Horje
Private slots are new and can be created via Instance private fields Code Example
Private slots are new and can be created via Instance private fields
// ES2022
class InstPrivateClass {
  #privateField1 = 'private field 1'; // (A)
  #privateField2; // (B) required!
  constructor(value) {
    this.#privateField2 = value; // (C)
  }
  /**
   * Private fields are not accessible outside the class body.
   */
  checkPrivateValues() {
  console.log(this.#privateField1); // output -> 'private field 1'
  console.log(this.#privateField2); // output -> 'constructor argument'

  }
}

const inst = new InstPrivateClass('constructor argument');
  inst.checkPrivateValues();


console.log("inst", Object.keys(inst).length === 0) //output -> inst, true
Source: dev.to




Javascript

Related
convert string to array with condition javascirpt Code Example convert string to array with condition javascirpt Code Example
upload file javascript mdn Code Example upload file javascript mdn Code Example
?. js Code Example ?. js Code Example
set playback speed js Code Example set playback speed js Code Example
How to add click event to table row js Code Example How to add click event to table row js Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8