From time to time, I find myself using the same group of statements and I would like to convert these statements into function. Are there ways, steps, procedure, or tools that will help me / aid me to do so?
When I develop in VS2008 in C#, I'll simply highlight a group of statements, and tell VS to automatically convert these into a method.
Again, if there are no tool, a procedure will do.
UPDATE
No need to post code. This is base on my experience with developing and refactoring JS code in which I've found a duplicate set of codes, but I was wary from changing the code since I might break the code.
search and replace is useful when you want to replace a set of common expression with a variable, something like replacing $(this)
to $this
.