With Javascript, I want to check how many differences there are between two strings.
Something like:
var oldName = \"Alec\";
var newName = \"Alexand
I don't have a Javascript implementation on hand per se, but you're doing something for which well-established algorithms exist. Specifically, I believe you're looking for the "Levenshtein distance" between two strings -- i.e. the number of insertions, substitutions and deletions (assuming you are treating a deletion as a change).
The wikipedia page for Levenshtein distance has various pseudo-code implementations from which you could start, and references which may also help you.