Skip to main content

All Questions

2 votes
1 answer
38 views

Exporting Class with Require yields error

There is a nuance that I seem to be missing. I have Googled so many fixes recommended for this problem I don't know what is real anymore, nothing seems to work. MyProject on Replit and the offending ...
The Jaded George's user avatar
0 votes
0 answers
46 views

Execute class methods in random order - JavaScript [duplicate]

I need to execute all methods in random order from main_method (i will create a class instance later). But when first function start executing it shows that "this" inside her is equal ...
dimazx's user avatar
  • 11
1 vote
1 answer
89 views

How can I get the script name where an object of class is initiated within the class in JavaScript

I was looking for a way to get all the filenames where my class is imported and initiated an object of the class. Is it possible to get? If yes, how?
dreygur's user avatar
  • 338
0 votes
1 answer
309 views

Check if object is Array of instance of specific object in Node.JS

I have a simple class in Node JS class Animal { constructor(name) { this.name = name; // more fields ... } } let objects = []; objects.push(new Animal('Dog')); objects.push(new ...
JAN's user avatar
  • 21.9k
0 votes
1 answer
772 views

nodejs Super expression must either be null or a function

In my UserService class I am trying to call my base class constructor with super. If i try to do this I get the following error: TypeError: Super expression must either be null or a function Here is ...
Ruben's user avatar
  • 515
1 vote
2 answers
219 views

OOP in Nodejs. Nesting Classes?

I am trying to create a class for each nfl team. in my code below you can see I create two https requests to an external API. the first request creates a class for each NFL team and has various ...
Jordan's user avatar
  • 175
0 votes
1 answer
756 views

Getter Method coming up undefined

I am having trouble with my getters coming back undefined when getting data from the API. but when I hard code the data using my class the record and division record return just fine. Does anyone ...
Jordan's user avatar
  • 175
0 votes
1 answer
900 views

Typescript: Not able to import object from another file

This seems like a very weird problem but for some reason I am not able to import a const declared in one file into another file. On importing the const I'm getting a TS error stating Module '"../...
Sarthak Kundra's user avatar
0 votes
2 answers
2k views

Conditionally extend the current class

I want a JavaScript class that can conditionally add additional methods into itself from separate files. The idea is to separate different concerns of the app into more manageable self-contained ...
Emphram Stavanger's user avatar
0 votes
1 answer
652 views

How to convert class with static items to module file

I have a class like this: export default class { static myConnection = GHD.initConnection(); static getCards = () => this.myConnection.getCards(); } And I call it as: import connector from '....
1110's user avatar
  • 6,859
0 votes
1 answer
384 views

How to split an ES6 class definition across files cross-referencing private members?

Referencing a private member E.G. this.#rts() gives the error: SyntaxError: Private field '#rts' must be declared in an enclosing class Although when that line is evaluated, the function has been ...
Petruza's user avatar
  • 12.3k
4 votes
1 answer
2k views

(javascript) invoke es6 getter using "call"

I'm trying to create a (class) instance that copies the behavior of another class, but using itself as the state context (this). Normal functions work fine (like the setValue function in the example ...
joniba's user avatar
  • 3,539
0 votes
3 answers
944 views

Check class property exist when calling from object in NodeJs

I'm working on nodeJs Here I create class and I want that when any property called which is not exist in this class it will print warning in console how can I do this? Maybe using somekind of class ...
Azeem Haider's user avatar
1 vote
2 answers
2k views

How to Destructure a huge JSON object dynamically?

class Options extends React.Component { constructor(props) { super(props); this.state = { //previously called validOptions //Whether JSON_output has been uploaded to Azure ...
Han's user avatar
  • 426
1 vote
2 answers
609 views

Constantly getting "x is not a function" error in node.js

I'm trying to call a method inside another method but I get error "x is not a function". The methods are in very same class. I'm new in node so I don't get its errors at all. My code is : file app.js ...
Alireza Mortezaei's user avatar

15 30 50 per page