Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- As in this example, App is a var which is function expression which contains init as var which is assigned a function expression with no name. After this I lose the focus. How do I even keep track of closing parenthesis and curly braces?
- And shouldn't the invocation be like:
- App.App().init()
- */
- var App = function App() {
- this.init = function() {
- var animals = ['cats', 'dogs', 'aardvarks', 'hamsters', 'squirrels'];
- var $list = $('#myList');
- animals.forEach(function(animal) {
- $list.append('<li>' + animal + '</li>');
- });
- };
- };
- var app = new App();
- app.init();
Add Comment
Please, Sign In to add comment