function parseBankAccount(bankAccount) {
    let m = {40:0,21:1,31:2,39:3,30:4,33:5,37:6,25:7,46:8,42:9}
    let arr = Array(9).fill(0);
    for(let i = 0; i < 9; i++){
        for(let j = 0; j < 3; j++){
            for(let k = 0; k < 3; k++){
                arr[i] += (j + 2) * (k + 1) * (bankAccount[i*3+j*28+k] == ' ' ? 0 : 1);
            }
        }
    }
    let ans = 0;
    for(let i = 0; i < 9; i++){
        ans *= 10;
        ans += m[arr[i]];
    }
    return ans;
}
/**
 * Returns the bank account number parsed from specified string.
 *
 * You work for a bank, which has recently purchased an ingenious machine to assist in reading letters and faxes sent in by branch offices.
 * The machine scans the paper documents, and produces a string with a bank account that looks like this:
 *
 *    _  _     _  _  _  _  _
 *  | _| _||_||_ |_   ||_||_|
 *  ||_  _|  | _||_|  ||_| _|
 *
 * Each string contains an account number written using pipes and underscores.
 * Each account number should have 9 digits, all of which should be in the range 0-9.
 *
 * Your task is to write a function that can take bank account string and parse it into actual account numbers.
 *
 * @param {string} bankAccount
 * @return {number}
 *
 * Example of return :
 *
 *   '    _  _     _  _  _  _  _ \n'+
 *   '  | _| _||_||_ |_   ||_||_|\n'+     =>  123456789
 *   '  ||_  _|  | _||_|  ||_| _|\n'
 *
 *   ' _  _  _  _  _  _  _  _  _ \n'+
 *   '| | _| _|| ||_ |_   ||_||_|\n'+     => 23056789
 *   '|_||_  _||_| _||_|  ||_| _|\n',
 *
 *   ' _  _  _  _  _  _  _  _  _ \n'+
 *   '|_| _| _||_||_ |_ |_||_||_|\n'+     => 823856989
 *   '|_||_  _||_| _||_| _||_| _|\n',
 *
 */
Returns the bank account number parsed from specified string.
You work for a bank, which has recently purchased an ingenious machine to assist in reading letters and faxes sent in by branch offices.
The machine scans the paper documents, and produces a string with a bank account that looks like this.



Each string contains an account number written using pipes and underscores.
Each account number should have 9 digits, all of which should be in the range 0-9.

Your task is to write a function that can take bank account string and parse it into actual account numbers.

@param {string} bankAccount
@return {number}

Example of return .






Returns the bank account number parsed from specified string . You work for a bank which has recently purchased an ingenious machine to assist in reading letters and faxes sent in by branch offices . The machine scans the paper documents and produces a string with a bank account that looks like this . Each string contains an account number written using pipes and underscores . Each account number should have 9 digits all of which should be in the range 0 - 9 . Your task is to write a function that can take bank account string and parse it into actual account numbers . @param { string } bankAccount @return { number } Example of return .
function parseBankAccount(bankAccount) {
    let m = {40:0,21:1,31:2,39:3,30:4,33:5,37:6,25:7,46:8,42:9}
    let arr = Array(9).fill(0);
    for(let i = 0; i < 9; i++){
        for(let j = 0; j < 3; j++){
            for(let k = 0; k < 3; k++){
                arr[i] += (j + 2) * (k + 1) * (bankAccount[i*3+j*28+k] == ' ' ? 0 : 1);
            }
        }
    }
    let ans = 0;
    for(let i = 0; i < 9; i++){
        ans *= 10;
        ans += m[arr[i]];
    }
    return ans;
}
function parseBankAccount ( bankAccount ) { let m = { 40 : 0 , 21 : 1 , 31 : 2 , 39 : 3 , 30 : 4 , 33 : 5 , 37 : 6 , 25 : 7 , 46 : 8 , 42 : 9 } let arr = Array ( 9 ) . fill ( 0 ) ; for ( let i = 0 ; i < 9 ; i ++ ) { for ( let j = 0 ; j < 3 ; j ++ ) { for ( let k = 0 ; k < 3 ; k ++ ) { arr [ i ] += ( j + 2 ) * ( k + 1 ) * ( bankAccount [ i * 3 + j * 28 + k ] == ' ' ? 0 : 1 ) ; } } } let ans = 0 ; for ( let i = 0 ; i < 9 ; i ++ ) { ans *= 10 ; ans += m [ arr [ i ] ] ; } return ans ; }
Returns the bank account number parsed from specified string.
Returns the bank account number parsed from specified string .