Function to check the characters are from the same row of the qwerty keypad
function checkValidity ( str ) { var x = str [ 0 ] ; var row = checkQwertyRow ( x ) ; for ( var i = 0 ; i < str . length ; i ++ ) { x = str [ i ] ; if ( row !== checkQwertyRow ( x ) ) { return false ; } } return true ; }