PBS 77a
Callback Demo

A JavaScript 'callbacks' demo for instalment 77 of the Programming by Stealth series.

This page is designed to be used as an acompaniment to PBS 77. It defines the various sample functions and variables used in that instalments examples. Open a JavaScript terminal on this page to play along!

The page defines the following:

peopleObjects
An array of objects representing people, each indexed by the keys firstName, surname, displayName, email, url & twitter
saySomething(something)
A function to render a message (passed as the first argument) as a toast.
doSomethingRandom(someFn)
A function which will execute a given callback with a random number as the first argument.

You can click this button to trigger an AJAX call that will fetch a random number from the URL https://www.bartbusschots.ie/utils/fakerWS/numberBetween/1/text?arg1=1&arg2=100 (must be running in a local web server for this to work) —