Тёмный
No video :(

Generating a random number in javascript 

Hitesh Choudhary
Подписаться 935 тыс.
Просмотров 50 тыс.
50% 1

Welcome to a youtube channel dedicated to programming and coding related tutorials. We talk about tech, write code, discuss about cloud and devops. That’s what we do all day, all year. We roll out a lot of series and videos on our channel.
All the learning resources such as code files, documentations, articles and community discussions are available on our website:
chaicode.com/
You can find our discord link, github link etc on the above website.
Twitter/X link: x.com/hiteshdo...
Discord link: hitesh.ai/discord
Learn React with 10 projects: • Let's learn react from...
Learn Docker: • A practical guide on D...
Learn Kubernetes: • Complete Kubernetes Co...
How does a browser works: • How does a browser wor...
How nodejs works: • How node JS works | En...
Learn Redux-toolkit: • Learn Redux Toolkit in...
Learn NextJS: • Nextjs Full stack course
Learn Typescript: • Why to learn Typescript
Learn Javascript: • Welcome to new JavaScr...
Learn React Native: • React Native Mastery: ...
Learn Zustand: • React state management...
Learn Golang: • How to get started wit...

Опубликовано:

 

29 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 90   
@edugetters
@edugetters 5 лет назад
You are so great teacher. Your work is highly appreciable.
@Makemineadoubles
@Makemineadoubles 3 года назад
such a
@swallowedinthesea11
@swallowedinthesea11 4 года назад
Thank you for the tutorial! Coming from Python, the start/end looks complex VS: import random dice = random.randrange(20, 26)
@madhusudankowlgi1113
@madhusudankowlgi1113 6 лет назад
Hitesh, your concept of viewing and doing is too good. Examples you have selected are excellent, easy to understand. Technically to the point. Hope to see more in further videos
@manojkumarm8398
@manojkumarm8398 4 года назад
Never Seen a Teacher like u✔
@ovirex
@ovirex 5 лет назад
Thanks man, I was looking for this because I didn't understand how it works but you explain it very well and simple. Greetings from Venezuela.
@Bajrang.707
@Bajrang.707 5 лет назад
This is really cool one! And you''re the great mentor for us!
@Makemineadoubles
@Makemineadoubles 3 года назад
you're a
@shankumondal2881
@shankumondal2881 4 года назад
You are not a programmer , you are a magician
@abhishek_dam
@abhishek_dam 3 года назад
that was quite a good explanation man thank you I have been looking so much but couldn't find any except yours. thanks again
@akshbansal7715
@akshbansal7715 5 лет назад
ceil and floor are actually other names for Lowest Integer Function and Greatest Integer Function
@pavantejavydhik7354
@pavantejavydhik7354 6 лет назад
such an interesting video, looking for it quite long time . lotsOfLove keep rocking Hitesh , 'm on my mac cant put smiles here please take all my wishes
@gbktechnologies6637
@gbktechnologies6637 3 года назад
23 video u ask subscribe , just now i did that. awesome videos .....life time videos
@Technoholicplus
@Technoholicplus 4 года назад
let upper = 1; let lower = 10; if (upper > lower) { let randomizer = function(up, low) { let myRandom = Math.random() * (up - low); let final = myRandom + 20; return `the random value inclusive of ${upper} and ${lower} is ${Math.round( final )}`; }; console.log(randomizer(upper, lower)); } else if (upper === lower) { console.log("Upper Lower can't be same"); } else { console.log("Upper value cannot be smaller than Lower"); } Thanks, bro I used Math.round to include both upper limit and lower limit.
@jaydattr9765
@jaydattr9765 2 года назад
let floatRes = Result can also bring the same output, no neet to write to.Fixed(2) for twice. at 5:12
@snowfall1984
@snowfall1984 Год назад
Thank you.. Now I understand the formula..
@hometv4061
@hometv4061 3 года назад
it was 1:30 in the morning and you were making videos for us
@vinitrai5020
@vinitrai5020 6 лет назад
Hi Hitesh, great to follow your videos.I am learning a lot from these videos.Thanks a lot!! Here I have written a very simple game.I want to share the code let userTurn=function(){ let user = Number(prompt('enter a random number')); return user; } let computerTurn=function(){ let system = Math.floor(Math.random()*10); return system; } for(i=1;ib){ console.log('user wins'); } else{ console.log('computer wins'); } } What do you say about the code and how can I make it better. Thanks in advance.
@vinaymanikant9710
@vinaymanikant9710 6 лет назад
Loving this series alot Hoping to have a complete bunch of JS series And sir please give alot of projects along with them
@RainOnline
@RainOnline 5 лет назад
i can;'t wrap my head around the fact that i would have never been able to write this function from the top of my head
@RainOnline
@RainOnline 5 лет назад
yeah well, im back! and this looks way too easy. Ive used the math.random function in more complicated functions such as color and string generators. Don't give up!
@YoYo-eg6rc
@YoYo-eg6rc 5 лет назад
Thanks you sir , I clearly understand How it work
@nishantghosh3513
@nishantghosh3513 4 года назад
we should use round() for get its​ closest integer so why we use floor or ceil
@anil0407
@anil0407 6 лет назад
let message = "I love the tutorial"; if(message) { console.log(message); } thank you sir. I am enjoying your tutorial.
@HiteshCodeLab
@HiteshCodeLab 6 лет назад
Thanks
@dikshitkaushik8387
@dikshitkaushik8387 6 лет назад
bhai there is no need if if else statement and u not use properly that if else statement stuff
@sanudajayathilaka3173
@sanudajayathilaka3173 5 лет назад
@@dikshitkaushik8387 nothing wrong with the code bro. He has checked whether the message is exist? if its true return message. He has done a wonderful job
@hackx_hive8221
@hackx_hive8221 6 лет назад
Your dedication really inspires..!👌👍🏼
@avisheksinha4264
@avisheksinha4264 6 лет назад
Thanks sir for this video 😊
@monikanb6120
@monikanb6120 4 года назад
Wow I really enjoii this series
@selimatasever4112
@selimatasever4112 5 лет назад
Thanks bro.. i liked the way you explain the details. Subscribed!!
@manuchowdary7848
@manuchowdary7848 4 года назад
Finally my confusion was clear
@srikantdas2523
@srikantdas2523 6 лет назад
It's really an awesome tutorials for beginners. I am going to subscribe it.
@stealthbusiness
@stealthbusiness 4 года назад
Thanks for putting the tutorial together. :) Is there a way to Password Protect online videos (RU-vid, Vimeo... etc) with some if not all of these features? Random Password Set the Expiration time or date Set the Total time a video can be viewed Set how many times the password is allowed Setup Password Groups I know it's asking a lot, if you're busy, I understand. You seem to have the skills to make it happen. Just putting it out there.
@mdmoinmoin8888
@mdmoinmoin8888 6 лет назад
love your teaching keep uploading videous like even if u dont get many views later on but many really watch all of it
@unyieldingjarnail
@unyieldingjarnail 5 лет назад
Always nice stuffs from you. And I want to know if you can share your system configuration pls
@harjapx
@harjapx 5 лет назад
Instead of Math.Floor, if we provide '0' value to the toFixed it still shows integer value without any decimal places then what's the point of using the Math.floor? Please explain...
@jackfrost8969
@jackfrost8969 4 года назад
this is beyond perfect. thanks a ton.
@nithsua
@nithsua 5 лет назад
And this series is really awesome
@joshiadvait8
@joshiadvait8 6 лет назад
*Just because you started this series your subscribers got increased a lot I think You should put some more free series on react native & database connectivity with same as well it will increase subscribers in Huge nos*
@HiteshCodeLab
@HiteshCodeLab 6 лет назад
Check again. Views on regular videos is high and views on JS series is so low. Anyways, these numbers are just numbers. I am just looking to move forward.
@StarDoesntUpload
@StarDoesntUpload 5 лет назад
22/7 is not Pi, it’s just close to Pi. Pi is an infinitely long string of numbers, and is therefore impossible to write as a fraction.
@aWiseCoder
@aWiseCoder 5 лет назад
Thanks I understand The concept now
@shawnedits161
@shawnedits161 4 года назад
sir how we can genreate random number in a given range without using math.Random() in javascript
@aurangzaibmanzoor1136
@aurangzaibmanzoor1136 3 года назад
how to stop generating the same random numbers with the database I want to generate roll numbers which should not be same so tell me.
@ShubhamSharma-rm9ry
@ShubhamSharma-rm9ry 6 лет назад
sir, i like this video as compare to random password generator project.
@manuchowdary7848
@manuchowdary7848 4 года назад
Thanku
@chandanbaruah7692
@chandanbaruah7692 6 лет назад
concept clear thanks
@niharranjanbhuyan9839
@niharranjanbhuyan9839 6 лет назад
Result = 22/7 But u have forgot to put let or var before result... But you got correct answer..How}??
@michaelobeng7660
@michaelobeng7660 5 лет назад
in javascript if you do not declare var or let the variable is still accessible and it becomes a global variable
@YoYo-eg6rc
@YoYo-eg6rc 5 лет назад
@@michaelobeng7660 yes you are true
@shreejasoni5171
@shreejasoni5171 4 года назад
watch his viedoe of var and let he is telling local and global
@HarpreetKaur-pm3so
@HarpreetKaur-pm3so 6 лет назад
"THE" best :)
@samosrecaipozitiva1764
@samosrecaipozitiva1764 4 года назад
Thank you you are great !
@babaji0997
@babaji0997 6 лет назад
Thank you so much sir......
@2002utube
@2002utube 5 лет назад
I think you are a developer...may be you know which are the mostly used all functions in Math lib . May be this will be useful. Because there are many in the documentation.
@abdullahalrifat4997
@abdullahalrifat4997 3 года назад
Thanks
@ruhankhandaker5198
@ruhankhandaker5198 6 лет назад
wao,, Another great video.
@ShubhamGupta-qb4gu
@ShubhamGupta-qb4gu 4 года назад
Smallest Code let a = Math.ceil(Math.random()*6); console.log(a);
@thangathirupathi7257
@thangathirupathi7257 4 года назад
thank you
@KK-wd5nc
@KK-wd5nc 6 лет назад
sir , wud u please tell us tht how to make dynamic img slider using JS ??????
@sonudeep6472
@sonudeep6472 4 года назад
But sir I have also got 0 .... sir what is the reason... please reply
@yeswanthchintapalli7144
@yeswanthchintapalli7144 6 лет назад
I NEED PANCARD VALIDATION THROUGH THE TEXTBOX THAT 5TH CHARACTER IN PANCARD NUMBER MUST MATCHES WITH THE SURNAME
@mohdsadique551
@mohdsadique551 4 года назад
I dont know why did you take this long route, i think you could have simply showed us : let dice = Math.floor(Math.random()*6)+1 and its done.
@shreejasoni5171
@shreejasoni5171 4 года назад
maybe he is trying to teach upper and lower concept. btw I got output by using Math.floor(Math.random()*6)+1 thanku
@RakeshSharma-df2ie
@RakeshSharma-df2ie 6 лет назад
Hello sir can you please explain me this code //generate random numbers between 83 to 93 let upper = 93; let lower = 83; let randomNum = Math.ceil(Math.random() *(upper - lower)) + lower; console.log(randomNum);
@RainOnline
@RainOnline 5 лет назад
93 - 83 = 10 . so you random a number from 0 to 10. and the end "+lower" means 83. , which means you random a number from 83 to 83 +10 which is 93, and result is 83 to 93
@hardik.motwani
@hardik.motwani 5 лет назад
You have used ceil so range will be from 1 to 10, + lower will make the range 84 to 93
@sulbhasharma92
@sulbhasharma92 5 лет назад
please also give series lyk this for node n react js too
@HiteshCodeLab
@HiteshCodeLab 5 лет назад
Available here courses.learncodeonline.in
@ANOOPKUMAR-cu2eo
@ANOOPKUMAR-cu2eo 6 лет назад
thanks sir
@EVOLUTIONSHORTSs
@EVOLUTIONSHORTSs 4 года назад
Can u create website for me i want to hire u as developer?
@chetask4558
@chetask4558 5 лет назад
math.random() * 5+1 doesn't gave 0 value how to deal with that
@subhranil764
@subhranil764 5 лет назад
Nice sir:)
@Srestha2023
@Srestha2023 4 года назад
why can't we just use math.ceil on math.random()*6
@shreejasoni5171
@shreejasoni5171 4 года назад
can you please elabore by which i can try
@abazur7742
@abazur7742 5 лет назад
9:52 starts talking about random
@edugetters
@edugetters 5 лет назад
@danyrupesarputharaj6969
@danyrupesarputharaj6969 6 лет назад
yes sir
@_ghost_69.
@_ghost_69. 4 года назад
Well random in python is easy than js
@yoyoma7273_6
@yoyoma7273_6 5 лет назад
Why don't we need to import math first?
@Ashish-es4nk
@Ashish-es4nk 6 лет назад
Thanks Hitesh for being awesome. I just created a function for random and let me know what you think? jsbin.com/comuruh/edit?js,console
@VIKASGUPTA-ec1kd
@VIKASGUPTA-ec1kd 4 года назад
who is here in 2020-corona panademic ?
@ovirex
@ovirex 5 лет назад
Figura del partido
@jibinbaby5030
@jibinbaby5030 4 года назад
That was not tricky at all sir. Catched in the very first exercise.
@prabu2778
@prabu2778 4 года назад
I think you are working in google
@konstantinpavlovic8472
@konstantinpavlovic8472 5 лет назад
2:35 :DDDDDD
@nithsua
@nithsua 5 лет назад
do you love maths? cuz i hate it
@dsaha7473
@dsaha7473 6 лет назад
😂😂
@dahabodarman6012
@dahabodarman6012 5 лет назад
thank you
Далее
=== vs == in javascript
6:48
Просмотров 42 тыс.
Maps and for of loop in javascript
22:35
Просмотров 44 тыс.
Why Random Numbers Aren't Random
9:17
Просмотров 76 тыс.
Methods and this keyword in javascript
13:55
Просмотров 62 тыс.
Basics of variables and constants in javascript
15:03
Просмотров 153 тыс.
Where to keep js file and selecting elements
13:53
Просмотров 28 тыс.
Arrow function basics in javascript 😃
13:41
Просмотров 65 тыс.
A talk about numbers in #javascript
13:10
Просмотров 97 тыс.