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.

Sanwar RanwaRank #23 · 44.7K reputationPosted Jun 2, 2019, 11:45 PM EDT
Amit GuptaRank #190 · 12.8K reputationPosted Jun 3, 2019, 4:38 AM EDT
Gajendra JangidRank #157 · 14.9K reputationPosted Jun 3, 2019, 7:22 PM EDT
gle winston13 reputationPosted Feb 6, 2020, 5:30 PM EST
Bhawna TutejaRank #2,418 · 584 reputationPosted Feb 10, 2020, 6:43 PM EST