JavaScript menjalankan dua fungsi secara bersamaan

/*
 * Running two functions at the same time can be
 * achieved using asynchronous functions.
 */
async function func1() {
	return 1;
}
async function func2() {
	return 2;
}
func1();
func2();
/*
 * In theory, the above two function calls are running
 * at the same time. In practive, however, they are
 * likely processed so fast that they are not
 * asnychronous.
 * To get the result of these functions, you need to
 * use the `then` method of the promise that is
 * returned. (You can also use the `catch` method in
 * the same way.)
 */
func1().then((res) => console.log(res)).catch((err) => console.error(err));
func2().then((res) => console.log(res)).catch((err) => console.error(err));
MattDESTROYER