Simple way to alert error messages in Javascript

Thank you Jacob Peattie for suggesting. It is very simple to use confirm() to replace alert() although confirm() has two options for users to select: OK and Cancel.

When users click OK or Cancel button, I use function focus() to direct users where to correct that empty Content. Here are my working sample codes:

   if(content === '') {      
       confirm('Please write description of your post.'); 
       tinymce.activeEditor.focus(); // for Visual Mode of WP Classic Editor
       $('#content').focus();           // for HTML Mode of WP Classic Editor
    }

Many thanks

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)