return number.length===18?/\\d{17}['X'|\\d]/.test(number):false

正则只需一行AC