debug javascript tips please

  • 1
  • Question
  • Updated 4 years ago
  • Answered
as per title.

I use console.log.

What can I do within the console? What are it's limits in terms of inline javascript debugging? Can I add breakpoints? Can I restart it with alterations within the console? etc. etc. etc
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,704 Points 20k badge 2x thumb

Posted 4 years ago

  • 1
Photo of Irvin Waldman

Irvin Waldman, Champion

  • 9,006 Points 5k badge 2x thumb
There are lots of good resources out there for debugging JavaScript in the browser.  Here's one:  http://www.pluralsight.com/courses/chrome-developer-tools.  
Photo of Moshe Karmel

Moshe Karmel, Champion

  • 8,646 Points 5k badge 2x thumb
I would also recommend using http://jshint.com/ to see if your code has unused variables, or bad curly braces etc. You can also use alert('Hello World') to see values and freeze execution.
Photo of JD Bell

JD Bell, Senior Product Engineer

  • 2,996 Points 2k badge 2x thumb
Like any good craftsperson, the tools you use are a very personal choice. They must work with you and not get in your way. There are plenty of tools out there, but there are a few popular ones that seem to meet most people's needs.

The Chrome Developer Tools built in to the Chrome browser are very popular and extremely powerful. You can read Google's official documentation on those tools here: https://developer.chrome.com/devtools

Firefox has an entire browser dedicated to developers, with many of the same powerful tools available in Chrome plus a few additional features I've not seen elsewhere: https://www.mozilla.org/en-US/firefox/developer/

There are also tools available for helping you to write, analyze and process your javascript. Personally, I like using Sublime text editor (http://www.sublimetext.com/) with Package Control (https://sublime.wbond.net/), Grunt (https://sublime.wbond.net/packages/Grunt) and a few other select grunt plugins (like https://github.com/gruntjs/grunt-contrib-uglify).

However, Eclipse (http://www.eclipse.org/downloads/packages/eclipse-ide-java-developers/keplerr) is also a very popular option and integrates a little bit better with Salesforce (https://developer.salesforce.com/page/Force.com_IDE_Installation).

These are just a few of the tools available, however, and it's good to try several different options to see which ones best fit your personality and style.
Photo of Irvin Waldman

Irvin Waldman, Champion

  • 9,006 Points 5k badge 2x thumb
Brackets is another very nice editor http://brackets.io/.

Want a code playground? http://www.sitepoint.com/7-code-playgrounds/
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,704 Points 20k badge 2x thumb
Do any of these editors need anything in order to work with the Skuid APIs? ie. will the properties autofill/dropbox?
Photo of Irvin Waldman

Irvin Waldman, Champion

  • 9,006 Points 5k badge 2x thumb
ST and Brackets support AutoCompletion.
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,704 Points 20k badge 2x thumb
Do I need to do anything in order to see autocompletion work for Skuid APIs?