- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
โ06-26-2023 04:52 AM
I am preparing for CAD , some questions are kind of confusing , can some one suggest the correct ans and some explanation please
1.
2.In a Business Rule, which one of the following returns true if the currently logged in user has the admin role?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
โ06-26-2023 05:43 AM
Hi @RudhraKAM
1. correct answer - Self Invoking
Self Invoking means -Self-invoking functions in JavaScript are the anonymous self-executing functions that are called after their definition. These JavaScript functions can run immediately when followed by the parentheses set (). This is self invoking template we used in business rule
for more details of self-invoking, please refer below link
https://linuxhint.com/self-invoking-functions-in-javascript/
2)In a Business Rule, which one of the following returns true if the currently logged in user has the admin role?
Correct answer- gs.hasRole('admin')
Please check and Mark Helpful or correct answer and let me know if any other help required for CAD Preparation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
โ06-26-2023 05:23 AM
Hi @RudhraKAM ,
These type of functions are called ๐๐บ๐บ๐ฒ๐ฑ๐ถ๐ฎ๐๐ฒ๐น๐ ๐๐ป๐๐ผ๐ธ๐ฒ๐ฑ ๐๐๐ป๐ฐ๐๐ถ๐ผ๐ป ๐๐
๐ฝ๐ฟ๐ฒ๐๐๐ถ๐ผ๐ป (๐๐๐๐) or self invoking functions
A function that is ๐ถ๐ป๐๐ผ๐ธ๐ฒ๐ฑ ๐ถ๐บ๐บ๐ฒ๐ฑ๐ถ๐ฎ๐๐ฒ๐น๐ ๐ฎ๐ณ๐๐ฒ๐ฟ ๐ถ๐ ๐ถ๐ ๐ฐ๐ฟ๐ฒ๐ฎ๐๐ฒ๐ฑ is called an IIFE, it is a stand-alone function with or without any name and no explicit invocation is required.
For invoking it, we simply ๐ฎ๐ฑ๐ฑ (); ๐ฎ๐ณ๐๐ฒ๐ฟ ๐๐ต๐ฒ ๐ฒ๐
๐ฝ๐ฟ๐ฒ๐๐๐ถ๐ผ๐ป, we can even pass arguments to it.
Every IIFE gets its ๐๐ฒ๐ฝ๐ฎ๐ฟ๐ฎ๐๐ฒ ๐ฒ๐
๐ฒ๐ฐ๐๐๐ถ๐ผ๐ป ๐ฐ๐ผ๐ป๐๐ฒ๐
๐ - any variables or functions inside IIFE go into this execution context.
These variables are not in the global environment and even if any other variable or function exists with the same name - ๐๐ต๐ฒ๐ ๐ฑ๐ผ๐ป'๐ ๐ถ๐ป๐๐ฒ๐ฟ๐ณ๐ฒ๐ฟ๐ฒ ๐๐ถ๐๐ต ๐ฒ๐ฎ๐ฐ๐ต ๐ผ๐๐ต๐ฒ๐ฟ. Variables and functions declared inside IIFE are ๐ฝ๐ฟ๐ถ๐๐ฎ๐๐ฒ ๐ฎ๐ป๐ฑ ๐ถ๐ป๐ฎ๐ฐ๐ฐ๐ฒ๐๐๐ถ๐ฏ๐น๐ฒ ๐๐ผ ๐๐ต๐ฒ ๐ด๐น๐ผ๐ฏ๐ฎ๐น ๐ฒ๐ป๐๐ถ๐ฟ๐ผ๐ป๐บ๐ฒ๐ป๐.
Here, executeRule is a named IIFE with arguments current and previous.
Refer to these docs as well: https://developer.mozilla.org/en-US/docs/Glossary/IIFE
https://www.geeksforgeeks.org/immediately-invoked-function-expressions-iife-in-javascript/
If my answer has helped with your question, please mark it as correct and helpful
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
โ06-26-2023 05:43 AM
Hi @RudhraKAM
1. correct answer - Self Invoking
Self Invoking means -Self-invoking functions in JavaScript are the anonymous self-executing functions that are called after their definition. These JavaScript functions can run immediately when followed by the parentheses set (). This is self invoking template we used in business rule
for more details of self-invoking, please refer below link
https://linuxhint.com/self-invoking-functions-in-javascript/
2)In a Business Rule, which one of the following returns true if the currently logged in user has the admin role?
Correct answer- gs.hasRole('admin')
Please check and Mark Helpful or correct answer and let me know if any other help required for CAD Preparation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
โ06-29-2023 09:22 AM
Thanks Kalyani ,What about the if the options have gs.hasRoleExactly(โadminโ) too ? which one we need to choose ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
โ07-05-2023 01:44 AM
Hi @RudhraKAM
Please find difference of gs.hasRole() and gs.hasRoleExactly()
hasRole('itil') True if the current user has the role specified, false otherwise. ALWAYS returns true if the user has the 'admin' role. hasRoleExactly('itil') True if the current user has the exact role specified, false otherwise, regardless of 'admin' role.
Please Mark Helpful and Correct if it all information helpful.