Promiseオブジェクトを使うと「画像読み込み完了後に関数の戻り値を返す」などの非同期処理完了後の動作をJavaScriptで記述できる。 <!DOCTYPE html> <html lang="ja"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script src="main.js"></script> <title>画像を読み込んだあとに処理をする(複数画像) </title> <style> *{ margin: 0; padding: 0; } body{ margin: 50px; } </style> </h
![JS:複数の画像読み込みが完了した時点で処理をしたい](https://cdn-ak-scissors.b.st-hatena.com/image/square/728ad0be0c97a20bf243e9379f04547a1b432e8f/height=288;version=1;width=512/https%3A%2F%2Ftorisky.com%2Fwp-content%2Fuploads%2F2023%2F10%2Fjs_image_loaded_check_eyecatch.jpg)