Javascript Transform Array To Another Array On Math