Number and Maths in Javascript | chai aur

  Рет қаралды 156,112

Chai aur Code

Chai aur Code

Жыл бұрын

Visit chaicode.com for all related materials, community help, source code etc.
github.com/hiteshchoudhary/js...

Пікірлер: 257
@pankajpanday6351
@pankajpanday6351 10 ай бұрын
A simple explanation that I always think about is "Math.random() sirf 0 se 1 tk random number generate krta hai 0 is inclusive, 1 is exclusive....So in this statement Math.random() * 10, the result can never be equal to 10 qki 10 lane k lie usko 1 se mulitply hona pdega jo ki possible nahi hai, to result hmesha 10 se niche hoga (it could be 9.999999) but 10 nhi hoga, or iske upr se agar aap Math.floor(Math.random() * 10) krte ho to result 0 se 9 tk koi bhi integer ho skta hai but 10 nahi, to 10 ko bhi range me include krne k lie hum usme 1 add kr dete hai.....that is if you do Math.floor(Math.random() * 11) to result [0,10] tk aaega both inclusive.....and at last isme bas aap 1 add kr doge to result [1,10] m convert ho jaega.... similarly, is concept ko max min m bhi leke jaa skte hai
@honblegaurav9917
@honblegaurav9917 Ай бұрын
vahi to aur isne to dhang se samjhaya hi nhi aur fake smile karta rehta bus
@faridullah3841
@faridullah3841 10 ай бұрын
Thank you for illuminating our learning journey, one JavaScript tutorial at a time. You're not just a teacher; you're an inspiration
@monty6393
@monty6393 10 ай бұрын
22:29 actually here , the plus one is added to include the maximum number(20) into the range .. Zero case is already handled by adding +min after it ... For example let's say the random returns 0.99999 then multiply it with 11(20-10+1).. , we will get 10.989.... take the floor value of this which will be 10 and now add it with min value which is 10 so overall answer would be 20(the ending range). That's the maximum case.. Similarly if random returns 0.0122... then everything will get 0 in the left and then adding min(10) to 0 will give us 10 which is the starting range..
@user-sn3jy7ee5k
@user-sn3jy7ee5k 7 ай бұрын
Thanks bro. I was confused at first
@chickukoshti3741
@chickukoshti3741 5 ай бұрын
still not getting
@Ali-2812
@Ali-2812 Ай бұрын
Bravo
@tech_channel110
@tech_channel110 11 ай бұрын
best man best channel best language best way of explanation on internet you are legend in explanation world
@tech_channel110
@tech_channel110 11 ай бұрын
sir your ability to convey intricate JavaScript concepts in a way that's both approachable and engaging is truly commendable, making us true asset to the learning community."
@kanhucharanpradhan6066
@kanhucharanpradhan6066 Жыл бұрын
i have already watched ur old javascript series bt this one is awesome
@suryanshjain4739
@suryanshjain4739 Жыл бұрын
Amidst these tough days of my life ,your videos are keeping me calm and sane....your voice is really soothing and the way you explain is impeccable
@RahulSharma-wz6yv
@RahulSharma-wz6yv 5 ай бұрын
When we participate in the growth of others, we often end up growing ourselves first. You have done a lot for coders and continue to do so, which is great. I am eager to watch the complete Python course that is currently ongoing. However, I am very busy working on my clients' projects. In my remaining time, I am learning more about JavaScript to improve my knowledge. Although I already know JavaScript, learning from you is both fun and fortunate for me. Thanks for all you are doing !
@shakib1010
@shakib1010 11 ай бұрын
I find this tutorials are so relaxing. 😀 Great playlist.
@yogeshkumarpatil591
@yogeshkumarpatil591 7 ай бұрын
Thank you for making such a beautiful javascript tutorial. Because You teach the actual javascript which is necessary for actual production development need. Very Very thank you. I will share your channel as much as possible to everyone. I really like your teaching style and I aslo need that type of javascript teacher. God bless you.
@user-gy3bf1pe9y
@user-gy3bf1pe9y 9 ай бұрын
you are truly a indian inspiration mentor . thank you for serving india and across the world through your talent
@kushagraagrawal7690
@kushagraagrawal7690 5 ай бұрын
Formula for generating random number : Math.floor(Math.random() * (total no. in the range)) + min_number For example : if you want to generate random number between 0 to 10, then min no. is 0, max no. is 10, total no. in the range is 11 ( max - min + 1), now putting to formula : Math.floor(Math.random() * (11)) + 0
@Arindam_1729
@Arindam_1729 Жыл бұрын
Thanks sir! Keep providing such videos!! This is Pure Gem!
@yosayaan7013
@yosayaan7013 2 ай бұрын
You are the best Teacher i have ever had
@abhinavgupta4866
@abhinavgupta4866 Жыл бұрын
The best thing I'm seeing in whole week.
@sounaksaha1455
@sounaksaha1455 Жыл бұрын
Sir, aise hi aap pls roz video dala kijiye, phir padhne mein bhi maza aayega...... Thanks a lot for your top notch hindi tutorials
@shashankkumarpandey4184
@shashankkumarpandey4184 7 ай бұрын
Amazing video, Thank you sir
@tech_channel110
@tech_channel110 11 ай бұрын
keep providing us such an amazing lectures May you live long life love from Pakistan
@boomaboom6458
@boomaboom6458 10 ай бұрын
G sir my nay pichla assesment kiya string kay methods ka bahut kuch sikhnay ku mila thank you
@webStream258
@webStream258 4 ай бұрын
Great Man (Salute to you for providing such an amazing content for us ) Thanks Btw following you from Pakistan 😍😍😍
@malaikaishfaq2717
@malaikaishfaq2717 11 ай бұрын
literally you're savour i singed up for ibm Frontend development on crousera although that's expensive and paid course but cloud not understand anything and came back to this series
@thetech17
@thetech17 9 ай бұрын
Awesome Sir Thank you👍
@barmoonz9769
@barmoonz9769 2 ай бұрын
sir your javascript series just became a game changer of my programming experience❤
@rishineupane
@rishineupane 4 ай бұрын
Thank You for explaining very clearly and precisely
@akashthoriya
@akashthoriya 11 ай бұрын
Explanation is to the point 🔥 toPrecision and Math.random() part was great
@babarshabbir2554
@babarshabbir2554 2 ай бұрын
"Excellent overview of number & math concepts in JavaScript! Clear explanations and examples. #js"
@sahilbutala6911
@sahilbutala6911 8 ай бұрын
The way are you teaching ❤️✨✨,i never seen ever my life... Thanks for this series sir
@abbykrm
@abbykrm 11 ай бұрын
Thanks Hitesh it's really helpful to revise the basics ❤❤
@jrahul42
@jrahul42 17 күн бұрын
Nice video concept clear about numbers and math thanks
@Instrumentation010
@Instrumentation010 8 ай бұрын
As usual enjoying this extra ordinary explanation of topics..
@ankittiwari3421
@ankittiwari3421 Жыл бұрын
sir ap ki padani ka alg style pura cosept clear ho jata h
@Raj10185
@Raj10185 10 ай бұрын
Nice explanation of Math.random . i really like it
@user-mo1sy5ck7r
@user-mo1sy5ck7r 5 ай бұрын
best Series ALL OVER UNIVERSE, thank you Sir 🙏
@babarshabbir2554
@babarshabbir2554 2 ай бұрын
"Excellent tutorial! Clear explanations of number and math concepts in JavaScript using Chai. Highly recommended."
@workspaceronnie8283
@workspaceronnie8283 9 ай бұрын
I just started this course so far It have helped me a lot looking forward to know more about js. Bhaiya one humble request to make a complete video on how to approach companies .
@kazitanim007
@kazitanim007 7 ай бұрын
Amazing teaching skill brother, keep up the good work. Also please make a video on how to get a job with basic HTML, CSS & JS while we keep learning.
@Pawankumar-i8c
@Pawankumar-i8c 4 күн бұрын
thank you so much sir for this lecture
@BioChemAcademy
@BioChemAcademy 7 ай бұрын
I was really having a bad day, but what make me calm and relax these days are watching your videos, thank you so much for everything sir you are an inspiration
@zohaibalishah91
@zohaibalishah91 3 ай бұрын
Sir You Are Just Awesome
@RG_official.
@RG_official. 9 ай бұрын
Really like the playlist.
@ZiaUrRehman-pv8mw
@ZiaUrRehman-pv8mw 7 ай бұрын
OutStanding Explaination💖💖💖
@PriyaSingh-ve9lf
@PriyaSingh-ve9lf 5 ай бұрын
u made javascript easy for me
@muneebshabbir9696
@muneebshabbir9696 10 ай бұрын
thank you your videos make easy js for me
@HimanshuMeena-hi9nq
@HimanshuMeena-hi9nq 2 ай бұрын
Formula for generating random number : Math.floor(Math.random() * (total no. in the range)) + min_number For example : if you want to generate random number between 1 to 6, then min no. is 1, max no. is 6, total no. in the range is 6 ( max - min + 1), now putting to formula : Math.floor(Math.random() * (6)) + 1 this could be used for ludo dice
@manojgyanwali2434
@manojgyanwali2434 3 ай бұрын
Thank you for this series
@pranjalgogoigaming-1209
@pranjalgogoigaming-1209 8 ай бұрын
Awesome video of Math object
@aryangaur228
@aryangaur228 11 ай бұрын
Thanks for this amazing tutorial sir!
@nikhatansari3310
@nikhatansari3310 9 ай бұрын
Thank you so much sir 😊
@surajrao123
@surajrao123 9 ай бұрын
sir aapki sari video bhot helpful hain, thank you. sir vo sach me chai tha kya😄😄
@vivektiwari6200
@vivektiwari6200 Жыл бұрын
The things you are charity in free, can't be got in paid too. thanks a lot sir.
@manthanharale3877
@manthanharale3877 Жыл бұрын
the formula was very intresting and this class was very memorebel
@richa-singh09
@richa-singh09 3 ай бұрын
well explained ...... thank you so much
@universalbeats.....8242
@universalbeats.....8242 4 ай бұрын
Best series ❤
@user-lo3hv9wb9u
@user-lo3hv9wb9u 5 ай бұрын
----- SUMMARY ----- Video 12 - Number and Maths in Javascript const score = 400 // JS auto detects it as a number const balance = new Number(100) // Using Number Function to explicitly define number in JS console.log(score) // 400 console.log(balance) // [Number: 100] Note: Number has comparatively less prototype properties (methods) than String Methods with examples: 1. balance.toString() // This converts a number into string 2. balance.toString().length // Once we convert it to String, all properties / methods of Strings are now open to us, such as length 3. balance.toFixed(2) // Used to reduce or round of to specific decimal values - Use Cases a. After calculation of GST b. In Ecommerce website 4. const otherNumber = 23.8966 otherNumber.toPrecision(3) // Output - 23.9 otherNumber = 123.8966 otherNumber.toPrecision(3) // Output - 124 otherNumber = 1123.8966 otherNumber.toPrecision(3) // Output - 1.12e+3 (exponential value) 5. const hundreds = 1000000 hundreds.toLocalString() // By default it converts into US standards hundreds.toLocalString('en-IN') // As per Indian Standards (Note: Check other formats in MDN Docs) 6. Other methods .MAX_VALUE .MIN_VALUE .MAX_SAFE_INTEGER .MIN_SAFE_INTEGER ----- Maths in JS ---- Maths library comes along with JS Methods ---- 1. Math.abs() // Converts +ve / -ve integer values to positive 2. Math.round(4.3) // Output - 4 3. Math.round(4.6) // Output - 5 4. Math.ceil(4.2) // Output - 5 (gives top value) 5. Math.floor(4.9) // Output - 4 (gives bottom value) 6. Math.min(4,3,6,8) // Output - 3 7. Math.max(4,3,6,8) // Output - 8 8. Math.random() // Gives random value between 0 & 1 in decimals Math.random() tricks ----- Math.random()*10 Math.random()*10 + 1 // This assures that values are atleast 1 & more than 1 (Math.random()*10) + 1 // To avoid any BODMAS rule miscalculation ---- Trick to randomize value between range ---- const min = 10 const max = 20 const randomValue = Math.floor((Math.random() * (max - min + 1)) + min)
@barikankitkumar
@barikankitkumar 4 күн бұрын
c
@krishnavamsi1126
@krishnavamsi1126 2 ай бұрын
thanks bro learnt new things
@user-ud6qx2dv8y
@user-ud6qx2dv8y Ай бұрын
thanks for sharing quality content
@ahmedbaig8543
@ahmedbaig8543 8 ай бұрын
"🌟 Great content, Chai aur Code! Your videos are both informative and engaging. I've been learning a lot from your tutorials, and the way you explain complex concepts makes coding more accessible. Keep up the fantastic work! 👏💻 #LearningFromTheBest #ChaiaurCode"
@Sarvesh_Coder
@Sarvesh_Coder Жыл бұрын
Are garda hai ye wala video, har baar ki tarah ji😀
@manthanharale3877
@manthanharale3877 Жыл бұрын
frist if all thankyou so much sir, and i think our jen-z are very lucky bicos of we have such kind of teachers.
@ApexModi6000
@ApexModi6000 10 ай бұрын
maine pehle padha hua tha JavaScript but ye sab nahi pata tha Thank You sir for this amazing course!!
@mrHock86
@mrHock86 2 ай бұрын
continuining day 3. Amazinng content sir ji.
@thecalgarians4597
@thecalgarians4597 6 ай бұрын
A granular detail that someone may miss while watching the video. Math.random() returns values 0 to 1 where 0 is inclusive but 1 is excluded. Overall, mind blowing series thus far. I'm binge watching :)
@user-bh6ic4bm3m
@user-bh6ic4bm3m 5 ай бұрын
Shukriya,
@WaqasKhanDurrani
@WaqasKhanDurrani 17 күн бұрын
Great explanation
@akroyalmaker
@akroyalmaker 3 ай бұрын
1 no. sir ji💯💯
@sagarbhavel8266
@sagarbhavel8266 8 ай бұрын
this video is really helpfull.
@manemanoj3068
@manemanoj3068 Жыл бұрын
Excellent,useful content Bhai..
@beautyspot3929
@beautyspot3929 10 ай бұрын
kia baat ha sir ap ke 😍
@harshkesharwani5112
@harshkesharwani5112 11 ай бұрын
At 22:26 if min =10 and max=20 then the value (Math.floor(Math.random()*(max-min +1)) ) => ensure that it will give value in the range [0,10] ..You have said 1 is added to avoid 0 but basically 1 is added to increase the range upto (10) ..if we will not add 1 it will give value in the range [0,9] .. Please clarify it ..And thanks for providing such valuable content.. Love You bhaiyya great series❤️!
@persevere08
@persevere08 11 ай бұрын
you are absolutely right, basically one is added to set the uppper limit to max value.
@rajrajeshwarsingh3119
@rajrajeshwarsingh3119 10 ай бұрын
Hey, bro in MDN docs it is clearly mentioned Math.random() returns that number that's greater than or equal to 0 and less than 1. So either you include 20 by adding 1 or exclude it by not adding 1, my suggestion is don't add 1, just go with the tradition i.e. docs. *And if you want to include 20 you have to add 1 inside(max- min + 1) not ((max-min) + 1), if you do this you'll get where we started where the value 10 will be excluded i.e. bodmass magic. *But in the video, there is a small explanation mistake at 20:08 where he @chaiaurcode says to avoid 0 you have to add 1 there i.e.(max- min + 1), if you do this only this step you'll get 0 value at some point there is a slimmest of chances because when Math.random() = 0, you will always get 0 because when you multiply anything with 0 obviously you'll get 0. So there's no point in adding "1" here because you'll get 0 at some point. Instead, he'd have added + 1 in the last equation. *Because when you look at the last equation it is correct in terms of the question where we want to include 10 and 20 as well. eg. (0.91*11) +10 = 20.01 or (0*11) +10 = 10😎😎. Hope that I've made my point. At last, JavaScript is a forgiving language so forgive it 😬😬and move on.... You can refer to the same here developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random
@armorkinggaming1933
@armorkinggaming1933 10 ай бұрын
@@rajrajeshwarsingh3119 The formula is correct. If you want to check, type the values: min1 = 10 max1 = 20 console.log(Math.floor(0.99999 * (max1-min1 + 1)) + min1); console.log(Math.floor(0.00000 * (max1-min1 + 1)) + min1); You can see, the formula is giving correct results for boundary cases and if boundary cases are correct, it means rest of the values will also be fine.
@hiphop861
@hiphop861 8 ай бұрын
Thank you ❣🥰🥰
@sayandipbhattacharya3097
@sayandipbhattacharya3097 4 ай бұрын
Hum isse formula ko use karke ek simple otp generator bana skte jisse understanding or clear hogi Hum bas agr range ko jo min or max likthe hai usse agr hum me min = 100000 and max me max = 999999 krde to hume 6 digt OTP ka range mil jata hai. Principle ekdam same hai bas range ko increase kar do. Example: function Otp() { let min = 100000 let max = 999999 console.log(Math.floor(Math.random() * (max - min + 1) + min)); } Otp(); Try kar ke dekho or ache se samjh ajyga Math.random with range ka case.
@anonymous_q_ho1245
@anonymous_q_ho1245 7 ай бұрын
Thanks for this wonderful contain 😊 and the way u teach is really appropriate Last line code was little complex but that you you give a good example Although I think I can use Math.ceil isnted of Math.floor But I do understand why did u used this example 😊
@nityasahajisomani
@nityasahajisomani 7 ай бұрын
content level 😍👌
@user-rl3bq1um1f
@user-rl3bq1um1f 8 ай бұрын
Hi dear Hitesh Sir, I liked your way of teaching, because you are not taking long time to explain any topic. I watched and visit other youTube channel instructor who have 1M, 2M, 5M. but they all are taking so long time to give less knowledge and understanding to us. I don't want to publish these name but they are copying you in this paid cources, and session. it's my bad, I came here after mess around/ wasting my time and energy there. And literally your video quality and editing,animation, voice quality it's superb. I am requesting for DSA from you. please provide us. best DSA series. i will be wait for the same. and thank you for providing such a nice content in free of cost. you are great person and my ideal person also.
@iamkmsyed
@iamkmsyed 5 ай бұрын
Thanks Sir
@pratibhaverma2063
@pratibhaverma2063 6 ай бұрын
At time 5:23 when the balance is converted to string using the to string() function , is it the copy of balance that is converted or the original variable?I'm asking in reference to the stack heap vedio previously watched of this playlist.
@_tobecontinued
@_tobecontinued 3 ай бұрын
Gazab :)
@livecodealone
@livecodealone 2 ай бұрын
Sir chai aur code is best
@abhisheksingh_26
@abhisheksingh_26 5 ай бұрын
Super❤
@taashukumar1155
@taashukumar1155 9 ай бұрын
maja aa gya chicha jaan
@Vikram_Singh_CS
@Vikram_Singh_CS Жыл бұрын
Nice Explanation!!
@tahasiddiqui4968
@tahasiddiqui4968 5 ай бұрын
You are great
@AmanKumar-un1he
@AmanKumar-un1he 6 ай бұрын
We would really appreciate a series on DSA with JS.
@user-fh6jk9vy7w
@user-fh6jk9vy7w 9 ай бұрын
great effort
@harshitatripathi2185
@harshitatripathi2185 5 күн бұрын
console.log((Math.random()*(max-min))+min); it will also work.
@sawerasajid4309
@sawerasajid4309 6 ай бұрын
At time 5:23 when the balance is converted to string using the to string() then i checked its datatype is not converted to string ??
@tarungehlaut4500
@tarungehlaut4500 Жыл бұрын
amazing video sir!!
@onkark7821
@onkark7821 5 ай бұрын
I declared a value as const val = 2000, here when I check the length, it gives output as 5 instead of 4. Can anyone answer to this question?
@ankushladani496
@ankushladani496 Жыл бұрын
Dhanyawad guruji 🙏
@DostMuhammad-sd6rx
@DostMuhammad-sd6rx 2 ай бұрын
amazing keep it up
@jiteshtechbeast
@jiteshtechbeast Жыл бұрын
This man is ❤❤❤
@himanshusain2597
@himanshusain2597 11 ай бұрын
Quality content ❤
@ByteNinjas69
@ByteNinjas69 10 ай бұрын
excellent...
@manthanharale3877
@manthanharale3877 Жыл бұрын
my every daut was clear and now iam good in numbers and math
@tech_channel110
@tech_channel110 11 ай бұрын
what is this error console.log(typeof numAsString.length); number
@softheartpeople
@softheartpeople 9 ай бұрын
awesome
@deadlylive_gaming7154
@deadlylive_gaming7154 11 ай бұрын
thanks
@akashbhosale3634
@akashbhosale3634 2 ай бұрын
gud one
@alikhursheed4140
@alikhursheed4140 3 ай бұрын
can we use ceil math function instead of floor
@kailashmaurya6528
@kailashmaurya6528 8 ай бұрын
can you give the shortcut key for running a program in codespace, I was typing the whole(node 01_Basics/06_nums_and_math.js) again n again
Date and time in depth in javascript | chair aur #javascript
18:13
Chai aur Code
Рет қаралды 146 М.
Array in Javascript | chai aur #javascript
18:55
Chai aur Code
Рет қаралды 185 М.
Я обещал подарить ему самокат!
01:00
Vlad Samokatchik
Рет қаралды 8 МЛН
Самый Молодой Актёр Без Оскара 😂
00:13
Глеб Рандалайнен
Рет қаралды 12 МЛН
Random number generator in JavaScript 🎲【4 minutes】
4:01
JavaScript in 1 Hour using W3Schools Website | W3Schools JavaScript Tutorial
1:00:53
5 JavaScript Mistakes Every Beginner Must Avoid 🔥
10:56
CodeWithHarry
Рет қаралды 178 М.
Objects in depth in javascript in hindi | chai aur #javascript
18:08
Chai aur Code
Рет қаралды 198 М.
My iPhone 15 pro max 😱🫣😂
0:21
Nadir Show
Рет қаралды 715 М.
Todos os modelos de smartphone
0:20
Spider Slack
Рет қаралды 64 МЛН