javascript - cannot access 'this' in nested function -
javascript - cannot access 'this' in nested function -            this question has  reply here:                               javascript “this” pointer within nested function                                        5 answers                                                    how access  right `this` / context  within callback?                                        4 answers                                      so need help i've been stuck on couple of hours now..   the problem i'm creating object called rank. rank needs db calls in mongodb   info fill matrix, needs perform more nested function calls on matrix haven't written yet. problem when i'm calling dorank() gets companies , transactions , seems  set them in rank when  phone call creatematrix can't access 'this'   i have tried using .bind(this) on each of functions in dorank() prevents error method doesn't exist when console.log @ end of dorank() results matrix undefined.    function rank(d...