However, I wouldn't use a loop at all, but [id^='input'], which means "Any element whose id starts with 'input'". Simply because it's easier to read and automatically scales if there are ever more (or less) than 10 elements.

It takes that function's code, replaces number with value of x and assigns it to variable fn, then fn is being assigned as event handler to correct item. There might be typos in that code or it might not work at all.