[SalesForce] How to use a normal Javascript function in Lightning Component

I'm known to using External JS library in Lightning Component but is there any way I can put a normal JS function like the on I would put in normal Visualforce such as function toggleDiv() {...}?

I'm getting error when I try to add <script>...</script> tag to Lightning Component.

Best Answer

Script tag blocks are not allowed in Lightning Components as they are a security risk. You should put your code in the controller, helper, or renderer as appropriate.