Skip to main content

Featured

The STEM Revolution: From Classrooms to Code Camps

  In Nepal, the "STEM Revolution" represents a significant departure from memorization and a move toward experiential, hands-on science, technology, engineering, and math education. This approach recognizes that although traditional classrooms are fundamental, they frequently fail to provide students with the critical thinking and problem-solving abilities that the modern world requires.  It is motivated by a shared understanding that in order for Nepal's youth to prosper in the digital era, they must not only comprehend ideas but also learn how to use them creatively to address pressing issues. Making education relevant and enabling students to be creators of technology rather than merely consumers are the goals of this revolution. Dynamic, unofficial learning settings like maker spaces, robotics clubs, and programming camps are at the core of this movement. These programs, which are frequently run by neighborhood tech companies and non-profits, act as dynamic centers...

Generating Random Number from Javascript

Hello guys, after reading this blog you will know how you can generate a random number through JavaScript

We can generate the random number through Math.random() function but this gives us number in decimal.
So we should write the Math.random()  * 10 inside the Math.floor to get a integer number not a decimal number from 0 to 10 (10 not included); In JavaScript Math is a object that helps you to do mathematical operations. And Math.floor() is a function that round offs the number and return a integer.


We can use different places where we have to make choosing from the computer. For example one array is there, from that array we have to make computer choose a array item.

Here's one code which help you in understanding 

arr = ["Rock", "Papper", "Scissor"]
random_num = Math.floor(Math.random() * arr.length)
alert(arr[random_num])

Comments

Popular Posts