MENU

2023-01-02から1日間の記事一覧

【JavaScript初学者】ランダムな数字を作成する方法

Math.randomを使用してランダムな数字を作成します。 1~10のランダムな数字を作成する方法 書き方 Math.floor(Math.random() * max + 1 - min) + min); 使い方 >main.js { console.log(Math.floor(Math.random() * 10) + 1); } 結果 >1~10のランダムな数字 …