the problem of using vanila Javascript is complexities of managing both DOM and all the logic and variables simpler
AngularJS and other front end frameworks are created to mainly solve this problem.
(*),Whatever is in case is a componenet that is used to bind model and view together.
whatever happens in a view affects model and the other way around as well.
see the folder
when declaring functions, variables, ect in global level, they may share same name with other third party libraries causing errors and unexpected results.
To stop polluting global namespace you can encapsulate related function in an object.
var myApp = {}
myApp.person = 'Kevin'
n/a
see the folder