Store a count of the keydown events along with a count of the keyup events. For each iteration you will need to subtract the keyup count from the keydown count. When the count reaches 0 you will have had as many keyups as keydowns and you can then run your function.
EDIT: this is FAR from perfect, but demonstrates the concept http://jsfiddle.net/K2ny2/1/
function testKeys(u, d) {
var delta = u - d;
console.log(delta);
if(0 == delta) {
$('#result').show();
}
}
You might want to include some code to avoid the problem when someone will hold down the keys (repeats).