PathFactory interview question

When would you use a javascript framework and why?