Random number generator in JavaScript ⁉

preview_player
Показать описание
00:02:57 random number generator
00:06:37 multiple random numbers

// RANDOM NUMBER GENERATOR
const min = 1;
const max = 6;
let randomNum1;
let randomNum2;
let randomNum3;

}
Рекомендации по теме
Комментарии
Автор

// RANDOM NUMBER GENERATOR

const myButton =
const label1 =
const label2 =
const label3 =
const min = 1;
const max = 6;
let randomNum1;
let randomNum2;
let randomNum3;

myButton.onclick = function(){
randomNum1 = Math.floor(Math.random() * max) + min;
randomNum2 = Math.floor(Math.random() * max) + min;
randomNum3 = Math.floor(Math.random() * max) + min;
label1.textContent = randomNum1;
label2.textContent = randomNum2;
label3.textContent = randomNum3;
}

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My website</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<button
<label id="label1"
<label id="label2"
<label id="label3"
<script src="index.js"></script>
</body>
</html>

body{
font-family: Verdana;
text-align: center;
}
#myButton{
font-size: 3em;
padding: 5px 25px;
border-radius: 5px;
}
.myLabels{
font-size: 3em;
}

BroCodez
Автор

Thank you, bro. I have learned in 2 days, more than I have understood in months, because of your unique style of teaching and then applying it in real work exercises immediately, this, is indeed, very very effective.

Oloche-zrid
Автор

Do you know lua? Would love to see a full lua course in the future. Also your videos are awesome!

marcogarcia
Автор

Hey bro since you have lot of videos on JavaScript already can you release more react videos, I think most of the people are waiting for react videos

shreehari
Автор

I think the thing multiplied to the floor function must be max - min + 1

calculus
Автор

Can we use trunc() instead of floor() to eliminate decimal portion?

dilip_s
Автор

Day 1 of asking for react.js course:- Can you pls make a react.js course pls I learned java, js, py, html and css all from you because your course is best so can you pls make a react.js course?

name_yug
Автор

So it's not apparent to me how you get this code to work in the first place. For reference, I'm in eclipse, started a new java project and typed char for char what you did and it just doesn't work. I see you're doing a js project in visual studio I think. How can I make this work in eclipse?

dirtyconsole
Автор

Hey I’ve got a question about deserialization I’m hoping you can help me with. I have a couple an object that implements serializable and fields in there if custom classes that are also serializable. I have a UID for each class too. Now I want to update the structure by adding a field in one of the classes that is a JPanel. How do I update the deserialize method (loadGame) to handle the addition of this field? I’m having trouble finding my answer elsewhere figured I’d come to the Bro. Thx

BowzaaComedy
Автор

Bro teaches it so well. I turned pro overnight!

brenmaxhow
Автор

Iam waiting for the React js series bro

Yahye_Aydh_Hassan
Автор

please keep doing the react tutorials ❤

hunin
Автор

Hey i know this has nothing to do with the Random Number Generator, but Im following your C++ Tutorial, and when I open a C++ File on Vscode, I get about 20 little command windows that pop up and close down. They all say MSYS2 MINGW32 Shell. Is this normal, or did something mess up?. When I run the code it appears to work just fine, but im not sure if those 20 or so windows are supposed to pop up and then close down

kitarikitsuga
Автор

He is a real king.
Full Kotlin course?

capslock
Автор

I have completed your 8 hr js video, please make some videos on fetch api like get post, delete and create

avishekchakrabarty
Автор

is there a specific reason why +1 is used for RNG, instead of Math.ceil ???

Mahiu
Автор

<*_> This is my seal. I have watched the entire video, understood it, and I can explain it in my own words, thus I have gained knowledge. This is my seal. <_*>

piotrmazgaj
Автор

Bro code can you work in problem solving by java

Chill_Mode_
Автор

Thanks, bro. You're a real bro 💪

helioobianchi
Автор

you should accecpt islam bro your talent is a gift from Allah

SAJIDFOYSAL-zolq