<p>How can I implement a <code>diff</code> function, such as Stack Overflow's question revision history?</p>

You have here a
javascript example
of the implementation of a diff algorithm.
Based on:
P. Heckel, A technique for isolating differences between files
Comm. ACM, 21, (4), 264--268 (1978).
The implementation, itself, has two functions, one of which is recommended for use:
```
```
diffString( String oldFile, String newFile )
```
```
This method takes two strings and calculates the differences in each. The final result is the 'newFile' marked up with HTML (to signify both deletions from the oldFile and additions to the newFile).