How to create a modal (popup) in moodle using jquery.
or any other way
For simple things, look at the core/notifications AMD module. That has things like simple alerts and yes/no questions.
For anything more complex, you need to get into core/modal (which is what the notifications module uses internally, I think.)
It depends how and where you want to use them, but Moodle uses Boostrap and Bootstrap incorporates modals, so your theme/block/whatever could simply make use of bootstrap modals.