Materi
Roadmap
Proyek
Sertifikat
Skillance Code Lab
Jalankan »
Skillance Code Lab Editor
Editor
Hasil
Split
Editor Kode Sumber
Tekan
Ctrl + Enter
untuk Menjalankan
<!DOCTYPE html> <html> <body style="font-family: sans-serif; padding: 20px;"> <h2>Generator Angka Acak (Random Number)</h2> <button onclick="acakAngka()" style="padding:10px 20px; font-weight:bold; cursor:pointer;">Acak Dadu (1-6)</button> <div id="angkaDadu" style="font-size:36px; font-weight:bold; color:#0d2e5c; margin-top:15px;">?</div> <script> function acakAngka() { // Menghasilkan bilangan bulat acak antara 1 sampai 6 const dadu = Math.floor(Math.random() * 6) + 1; document.getElementById('angkaDadu').innerText = "🎲 " + dadu; } </script> </body> </html>
Hasil Tampilan (Browser Preview)
Muat Ulang