Reviewing functions in js