/    Sign up×
Community /Pin to ProfileBookmark

understanding function inside function .

hey guys have a look at the below function , very simple and straightforward :

[CODE]function countdown (sec, onTick) {
onTick(sec);
if (sec) setTimeout(function () {
countdown(–sec, onTick);
}, 1000);
}

onload = function () {
countdown(5, function (sec) {
console.log(sec ? sec + ‘ ‘ : ‘BOOM!’);
});
};

onload();[/CODE]

what is the js terminology for “countdown” inside the onload function ?

Thank you.

Gautam.

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@Clock_OutJun 30.2015 — [COLOR="#0000FF"]countdown[/COLOR] will be invoked when[COLOR="#0000FF"] onload[/COLOR] is invoked.
Copy linkTweet thisAlerts:
@gautamz07authorJun 30.2015 — ahh i really was't asking how the function works . i would like to know the following :

what is the js terminology for "countdown" inside the onload function ?
Copy linkTweet thisAlerts:
@KeverJun 30.2015 — countdown(..., ...) is just a function call with two arguments. The 5 for parameter sec and a callback function for parameter onTick.
Copy linkTweet thisAlerts:
@Clock_OutJun 30.2015 — It really is just a function invocation/call. There are no other special terms for it.
×

Success!

Help @gautamz07 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...