JQuery ready Calling No Argument Function returning Dice Roll

JQuery ready Calling No Argument Function returning Dice Roll

 

Lines 15 and 16 demonstrate using the getDiceRoll() function used as an expression. The getDiceRoll() function on lines 22 to 27 accepts no argument values but returns the value of the roll of one dice on line 26 using the return statement. Line 20 uses the JQuery html method to update the #helloResults element found on line 53. For beginners learning Javascript and JQuery.

Sample Console Output

Sample Console Output

Testing to See If It Works

Open a web browser console window supports the console object for this example. In that console window you will see messages from the Javascript to help you understand what code is being executed.

If your console window was not enabled when you opened this page, then enable and refresh/reload this page to see again.

JQuery Page for Latest Version Download and CDN