4:30 - Haha... Your videos are SO interactive!! I was just about to ask this question in comments. Before I've seen your explanation I paused the video and played with Math.ceil() in the VSC - couldn't get 0 in practice but I figured that theoretically it's possible. And here you go confirming my thoughts. Just amazing! :))
Type coercion is something that is confusing in Javascript - especially if you are coming from another language like Java. Article: www.freecodecamp.org/news/js-type-coercion-explained-27ba3d9a2839/
Why do we say that random numbers from 1 to 10?Because we also get number 0.Then should we call it random numbers from 0 to 10?I confuse my brain maybe, but it made me think a lot)
There is a graphic near the end of the video. I also suggest rewatching that part. I do not think I can explain it better in comments than I did in the video.
From MDN: "The Number.isNaN() method determines whether the passed value is NaN and its type is Number." Link: developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN
I was playing around with Math.min and Math.max functions and came across console.log(Math.min()); //infinity console.log(Math.max()); //-infinity I have been trying to understand it through various blogs but couldn't. Please somebody explain. Thankyou!
It's built into the API itself. MDN: "The Math.min() function returns the smallest of the numbers given as input parameters, _or Infinity if there are no parameters_ ." Opposite for Math.max() Link: developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/min
@@DaveGrayTeachesCode Yes. I do scientific programming with Pandas, Numpy, SymPy, SciPy, Plotly, Matplotlib etc, but not having a way to define arrays as in arange() or linspace() methods, limits the capabilities of Javascript for scientific programming. The random() function in Numpy has many more features, that's all. I'm pretty sure there is a way, but the learning curve is steep. You have a great tutorial though. :-)
4:30 - Haha... Your videos are SO interactive!! I was just about to ask this question in comments. Before I've seen your explanation I paused the video and played with Math.ceil() in the VSC - couldn't get 0 in practice but I figured that theoretically it's possible. And here you go confirming my thoughts. Just amazing! :))
Good job, Grigory!
you are a god to me sir !!!. I learnt lot from your free courses. 💗❤
he is a "kind man" not god.
console.log(Math.round("43")); // outputs 43?
I was expecting NaN? as 43 is a string here?
Type coercion is something that is confusing in Javascript - especially if you are coming from another language like Java. Article: www.freecodecamp.org/news/js-type-coercion-explained-27ba3d9a2839/
@@DaveGrayTeachesCode Wasn't aware with this concept. Thanks for introducing me to it. Will read about it now.
Why do we say that random numbers from 1 to 10?Because we also get number 0.Then should we call it random numbers from 0 to 10?I confuse my brain maybe, but it made me think a lot)
I suggest a rewatch. You'll get it! 💯
add + 1
Hello, sorry, but I did not understand properly why Math.ceil is not a good way while generating random numbers?
There is a graphic near the end of the video. I also suggest rewatching that part. I do not think I can explain it better in comments than I did in the video.
is it because Math.random() samples from [0, 1) instead of (0, 1]? otherwise Math.ceil will be preferred.
stackoverflow.com/questions/15830658/random-number-math-floor-vs-math-ceil
ua-cam.com/video/vzLdq3b0w3Y/v-deo.html link to where it is explained.
console.log(Number.isNaN(0 / 0)); //outputs true??
console.log(Number.isNaN(42)); //outputs false??
From MDN: "The Number.isNaN() method determines whether the passed value is NaN and its type is Number." Link: developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN
Amazing lecture but please reduce the intro sound omg My ears drums almost blasted 😭
I was playing around with Math.min and Math.max functions and came across
console.log(Math.min()); //infinity
console.log(Math.max()); //-infinity
I have been trying to understand it through various blogs but couldn't.
Please somebody explain.
Thankyou!
It's built into the API itself. MDN: "The Math.min() function returns the smallest of the numbers given as input parameters, _or Infinity if there are no parameters_ ." Opposite for Math.max() Link: developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/min
If only Math had 'linspace'
Sounds like you have a Python background 😀
@@DaveGrayTeachesCode Yes. I do scientific programming with Pandas, Numpy, SymPy, SciPy, Plotly, Matplotlib etc, but not having a way to define arrays as in arange() or linspace() methods, limits the capabilities of Javascript for scientific programming.
The random() function in Numpy has many more features, that's all.
I'm pretty sure there is a way, but the learning curve is steep.
You have a great tutorial though. :-)
Thanks KJ. I'm enrolled in a Programming for Data Analytics with Python course this semester. 🚀