Call functions in the console

Hei there,

Sorry for the newbe question but i cant seem to find an working answer anywhere.

How do i call a function from Chrome/Safari console?

For example i have a page called CheckoutNew and a function called doSomething() how do i call it from the console of the web browser.

Or calling it from a provider call, a provider called CheckoutProvider and a function called doSomething().

I would like to call it from the safari console, the same way i call a function in vanila javascript.

Thanks in advance


It depends on the scope of the function, if the scope of the function is limited to only a controller or page, then it can be called only from that controller or page, if you want to call a function from the console, you can add the function to the window

window.function_name = function(){}

and then call it from the console, though i will advise against doing this.