November 17th

JS Comment Trick

I learned this trick at this year’s jQuery Conference—it’s a quick toggle for commenting out blocks of code, by adding a single forward slash.

This runs as usual:

//*/
	$('input').value('boston, ma');
	$('form').trigger('submit');
//*/

This comments out the block of code:

/*/
	$('input').value('boston, ma');
	$('form').trigger('submit');
//*/

It’s handy for switching a test process on and off.

  1. wilto posted this