Ready Monetized Wordpress Website

EARN MONEY FREELANCING

Friday, June 7, 2019

Simple question about callback functions in JavaScript

For this code:

https://codepen.io/DragonG/pen/EzqZNP

Can you elaborate on what order everything gets executed in? For example, take

function doMath(number1,number2,callback){ if (typeof callback === “function”) { var result = callback(number1,number2); document.getElementById(“theResult”).innerHTML += (callback.toString() + “<br><br>The result is: “ + result + “<br><br>“); }

and

function multiplyThem(number1,number2){ var calculation = number1 * number2; return calculation; }

and call it with

doMath(5,2,multiplyThem);

What is the order in which everything gets executed? Can you go through it step by step? I'm having a little trouble visualizing how it all works. Thanks a bunch you are all super great people!

submitted by /u/LovelyLionLily
[link] [comments]

from web_design http://bit.ly/2MyNnxn
via IFTTT

No comments:
Write Your Comments

Ready Monetized Blogger Gaming Website