Quantcast
Channel: Include a class in another class - Stack Overflow
Browsing all 3 articles
Browse latest View live

Answer by daddygames for Include a class in another class

class2.jsclass Class2 { constructor(){} doSomething() { return new Promise((resolve, reject) => { resolve(`I did something too!`); }); }}exports.Class2 = Class2;class1.jsconst Class2 =...

View Article



Answer by r7r for Include a class in another class

You will need to export the other 2 JS classes with module.exports, and whichever file needs (main.js I believe) needs to import them using require and proper file path.//class1.jsfunction class1() {...

View Article

Include a class in another class

I have a main.js file and 2 classes files (.js of course). I'll use nodejs.Here is what i need to achieve:main.js class 1.js class 2.js-------- --------- ---------callin class 1 doing somethin do...

View Article
Browsing all 3 articles
Browse latest View live




Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>