CAD · Question #204
Here is the Business Rule script template: This type of JavaScript function is known as:
The correct answer is D. Self-invoking. The standard Business Rule script template wraps the logic in a self-invoking function (also called an Immediately Invoked Function Expression, or IIFE). The pattern looks like: (function executeRule(current, previous) { / logic here / })(current, previous); - the function is…
Question
Here is the Business Rule script template:
This type of JavaScript function is known as:
Options
- AConstructor
- BScoped
- CAnonymous
- DSelf-invoking
How the community answered
(29 responses)- A7% (2)
- B3% (1)
- D90% (26)
Explanation
The standard Business Rule script template wraps the logic in a self-invoking function (also called an Immediately Invoked Function Expression, or IIFE). The pattern looks like: (function executeRule(current, previous) { /* logic here */ })(current, previous); - the function is defined and immediately called in the same expression, passing 'current' and 'previous' as arguments. This is 'self-invoking' because it invokes itself at the point of definition, without needing an explicit external function call.
Topics
Community Discussion
No community discussion yet for this question.