Jump to content

Creating object instance from within a nested object


Mad_Griffith

Recommended Posts

I have the following data:

module.exports = {
	get myProp() {
		return {
			ExternalModuleObject,
		} = require("./myexternalmodule")
	}
	init: function() {
		myprop = new ...
	}
}

How to correctly create an ExternalModuleObject's instance inside init()?

Edited by Mad_Griffith
Link to comment
Share on other sites

This is not valid Javascript syntax, you can't have a literal value on the left side of an assignment operator. Maybe that's a thing in Node.js, but I don't have any experience with that.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...