async js

Run Settings
LanguageJavaScript
Language Version
Run Command
function changingAddress(data) { return new Promise((resolve, reject) => { setTimeout(() => { if (typeof data === "number") { reject("data bukan string"); // Reject jika data bukan string } else if (data === undefined) { reject("data kosong"); // Reject jika data kosong } else { resolve("alamat sudah di ubah"); // Resolve jika alamat berhasil diubah } }, 1000); }); } async function addressCheck(addressProp) { try { const resultChanging = await changingAddress(addressProp); // Menunggu hasil dari changingAddress console.log("ini result changing", resultChanging); } catch (error) { console.log("ini error address", error); // Menangani error jika ada } } addressCheck();
Editor Settings
Theme
Key bindings
Full width
Lines