Jquery is still standard part of drupal core and when using JavaScript or Ajax you will probably use Jquery and Jquery once function. Code can be found in core/assets/vendor/jquery-once/jquery.once.js so you could look how it works. It is pretty similar as in D7, look at the comments on how to use it.
$('body').once('views-form').each(function () { // some code here })
As stated in comments "To execute a function on the once set, you can use jQuery's each()." also note that once looks for IDs so in above example, "views-form" would be ID of a DIV.