How to debug js in jsfiddle

I look at this jsfiddle: http://jsfiddle.net/carpasse/mcVfK/ It works fine, this is not a problem, I just want to know how to debug javascript. I tried using the debugger command, and I cannot find it in the sources tab. any idea how i can debug this?

some code from the script:

angular.module('app', ['appServices']) .config(['$routeProvider', function($routeProvider) { $routeProvider. when('/home', {templateUrl: 'home.html', controller: HomeCtrl}). when('/list', {templateUrl: 'list.html', controller: ListCtrl}). when('/detail/:itemId', {templateUrl: 'detail.html', controller: DetailCtrl}). when('/settings', {templateUrl: 'settings.html', controller: SettingsCtrl}). otherwise({redirectTo: '/home'}); }]); 
+85
debugging angularjs jsfiddle
Oct 18 '13 at 22:32
source share
5 answers

JavaScript is executed from the fiddle.jshell.net folder of the Sources tab in Chrome. You can add breakpoints to the index file shown in the image below.

Debugging JSFiddle in Chrome

enter image description here

+44
Apr 7 '15 at 12:25
source share

Use the debugger; statement debugger; in code. The browser inserts a breakpoint in this statement, and you can continue to work in the browser debugger.

This should work at least in chrome and firefox. https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Statements/debugger

 angular.module('app', ['appServices']) .config(['$routeProvider', function($routeProvider) { // *** Debugger invoked here debugger; $routeProvider. when('/home', {templateUrl: 'home.html', controller: HomeCtrl}). when('/list', {templateUrl: 'list.html', controller: ListCtrl}). when('/detail/:itemId', {templateUrl: 'detail.html', controller: DetailCtrl}). when('/settings', {templateUrl: 'settings.html', controller: SettingsCtrl}). otherwise({redirectTo: '/home'}); }]); 
+21
May 18 '17 at 8:56
source share

Something worth mentioning. If you ever use chrome dev tools. Press ctrl + shift + F and you can search all the files in the source.

+5
Nov 26 '16 at 23:47
source share

In addition to other answers.

It is often useful to simply write debugging information to the console:

 console.log("debug information here"); 

The output is available in the dev tools browser console. For example, it was registered from regular javascript code.
It is quite simple and effective.

+3
Jan 13 '16 at 16:11
source share

Here is another place :)

In Jsfiddle.net node.

enter image description here

+1
Apr 17 '16 at 13:15
source share



All Articles