Hi everyone,
I have a button in my app that triggers some custom JavaScript code (added in a JavaScript node or through the button's event). I want to debug this code to check what's happening when the button is clicked.
Could someone please guide me on how to properly debug this JavaScript using browser DevTools or any other method in OutSystems?
Appreciate any help.
Hi @Juvairiya Jabbar ,
You can use console.log() to display JavaScript values in the debugger window.
Example:
a = 5;b = 6;c = a + b;console.log(c);
Also, in the debugger window, you can set breakpoints in the JavaScript code. The debugger keyword stops the execution of JavaScript, and calls (if available) the debugging function.
let x = 15 * 5;debugger;document.getElementById("demo").innerHTML = x;
_____
For reference please check these articles on JS Debugging:
Hi,
Thank you so much for your helpful response!
Hi @Juvairiya Jabbar, you can add 'debugger;' to create breakpoints in your JS, alternatively you can simply just add 'console.log();' at specific places to see what is happening.
Please refer to this for more details, JavaScript Debugging.
ThanksGitansh Anand