Answers for "js class async constructor"

1

js class async constructor

function asyncRequest(id){
	return new Paormise(/*.....*/);
}
class MyClass {
	constructor(name, age, cityId) {
    	(async function() {
          this.name = name;
          this.age = age;
          this.city = await asyncRequest(cityId);
        })();
    }
}
Posted by: Guest on September-11-2020
1

async constructor javascript

function asyncRequest(id){
	return new Promise(/*.....*/);
}
class MyClass {
	constructor(async) {
    	(async function() {
          this.city = await asyncRequest(async);
        })();
    }
}
Posted by: Guest on March-10-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language