Unexpected alert
112 // Add manager to team list
113 $('#team-list').append(creteListItem(intern));
114 } catch (err) {
115 alert(err);116 }
117 });
118
Unexpected alert
87 // Add manager to team list
88 $('#team-list').append(creteListItem(engineer));
89 } catch (err) {
90 alert(err); 91 }
92 });
93
Unexpected alert
62 // Add manager to team list
63 $('#team-list').append(creteListItem(manager));
64 } catch (err) {
65 alert(err); 66 }
67 });
68
Description
JavaScript's alert
, confirm
and prompt
functions are widely considered to be obtrusive as UI elements and should be replaced by a more appropriate custom UI implementation.
Furthermore, alert
is often used while debugging code, which should be removed before deployment to production.
Bad Practice
alert("here!");
confirm("Are you sure?");
prompt("What is your name?", "John Doe");
Recommended
customAlert("Something happened!");
customConfirm("Are you sure?");
customPrompt("Who are you?");
function foo() {
const alert = myCustomLib.customAlert;
alert();
}