Generate some events
- Write a function to generate a series of random numbers. The function should print a random number between 1 and 1000 every 1 second.
function generateTerms ()
{
// your code here that prints a random number every second
} - Implement a callback
Extend the generateTerms function in step 1 to call a supplied callback with the generated random number every second. Test the callback by making it do the printing task
function generateTerms (callback)
{
// your code here that calls the supplied callback with a random number every second
}
function callback(term)
{
// your code here that prints the term
}
generateTerms(callback) - Print a running count
Extend the callback to count and print a running count of the incoming terms - Print a running average
Extend the callback to compute and print a running average of the incoming terms - Print a running standard deviation
Extend the callback to compute and print a running standard deviation of the incoming terms.
Bhawna TutejaPosted Feb 10, 2020, 11:43 PM
gle winstonPosted Feb 6, 2020, 10:30 PM
Gajendra JangidPosted Jun 3, 2019, 11:22 PM
Amit GuptaPosted Jun 3, 2019, 8:38 AM
Sanwar RanwaPosted Jun 3, 2019, 3:45 AM