Skip to main content
4 votes
1 answer
93 views

Before we begin, I'm running on a webpack-dev-server, and I'm building a to do list app. My goal is to improve my understanding of how accessors behave so that I can standardizing my writing style ...
Bryan Reamillo's user avatar
1 vote
2 answers
101 views

Given this code: class Foo { data = { x: 1 }; } class Bar extends Foo { override data = { ...super.data, y: 1 }; } TypeScript complains on the super.data part: Class field 'data' defined by the ...
user avatar
0 votes
0 answers
61 views

I was wondering if there are any differences between the two following class implementations: class Days(days:AnyVal): val n: AnyVal = days and class Days(val n:AnyVal) Does n has the same ...
Taras Z's user avatar
  • 21
0 votes
1 answer
116 views

By callable object I mean an object that's also a function similar to jQuery. There's plenty of resources for doing this, such as this article. However problem arise when I try to implement private ...
Shaw's user avatar
  • 173
1 vote
2 answers
110 views

Considering the following code class A { a; constructor() { console.log(2); this.inv(); } inv() { console.log(4); this.a = "a value"; } } class B extends A { b; constructor(...
leopik's user avatar
  • 2,351
4 votes
2 answers
403 views

In the following code, the base class has four properties: a getter, a field, and a couple of methods that prints out the values of the other two. In the subclasses, the base getter can be overridden ...
Nexus's user avatar
  • 190
0 votes
1 answer
99 views

So I have a component that displays rows of data in a table. I have an input for the function that should run if someone double clicks a row. I want to default that to doing something with the router. ...
Brian Davis's user avatar
5 votes
2 answers
6k views

In this program: class Example { #privateMember = 123; // these are fine addNumber (n) { return this.#privateMember + n; } doAddNumber (n) { return this.addNumber(n); } // "cannot ...
Jason C's user avatar
  • 40.6k
3 votes
1 answer
515 views

I'm trying to use JS classes with private fields for a React app (because I still find it weird to use naked Object instances everywhere). React uses the concept of immutable state, so I have to clone ...
Radu C's user avatar
  • 1,439
2 votes
1 answer
3k views

I'm playing around with ES6 classes in JavaScript and I'm wondering if it's possible for a child class to inherit private properties/methods from a superclass, while allowing the subclass to mutate ...
WillWillington's user avatar
2 votes
1 answer
151 views

Looking at this simple code : class Animal { someField = 42; animalFunc() { console.log('animal') } } class Lion extends Animal { lionFunc() { console.loge('lion') }...
Royi Namir's user avatar
  • 149k
0 votes
1 answer
235 views

Here's the program: [SerializeField] ARPointCloudManager mArPointCloudManager; private int numPointsUpdated = 0; // Start is called before the first frame update void Start() { ...
ahiyantra's user avatar
8 votes
1 answer
2k views

Before, I would use the old convention of naming fields intended to be private with an _ suffix or prefix. class X{ constructor() { this.privateField_; } privateMethod_() {} } Now that ...
junvar's user avatar
  • 11.7k
4 votes
2 answers
2k views

I followed the advice on How do I configure ESLint to allow fat arrow class methods which states to set the parser to babel-eslint. I installed it and updated my config file as follows: { "...
user17791008's user avatar
4 votes
1 answer
903 views

I have a JavaScript class and inside it I have an async method which looks like below. class ABC { func = async () => { //----line 10 //some code } func2 = () => { //----line ...
Naxi's user avatar
  • 2,264

15 30 50 per page
1
2 3 4 5