Objects/closures for storing movie information I'm currently in the process of learning JavaScript and what it has to offer. I thought writing a simple web app that would allow me to add/remove/show my favorite movies would be a nice learning experience. I'm curious as to what the best solution would be for an object to house all of the data. It would be triggered by an event such as the clicking of a button.  

var Movies = (function() {
    var movieList = [];

    return {
        add : function(newTitle, newRating) {
            movieList.push({title: newTitle, rating: newRating});
        },
        show : function() {
            for(var i = 0; i &lt; movieList.length; i += 1) {
                console.log(movieList[i].title + ": " + movieList[i].rating);
            }
        },
        del : function(titleString) {
            for(var i = 0; i &lt; movieList.length; i += 1) {
                if(movieList[i].title === titleString) {
                    movieList.splice(i, 1);
                    break;
                }
            } 
        }
   };
}());


If I'm using an IIFE, or the use of closures incorrectly, please let me know. I want to learn JavaScript properly.
You're using the "module" pattern, which works well for many use cases. Your code for this pattern is correct as it stands. The best pattern to use is more about how you are planning to use it.

Some different patterns and why they might be better depending on your use case:


This module pattern is a little difficult if you ever needed to create two movie lists on the same page. A different pattern would be the constructor pattern. This would allow you to easily initialize a new list on the same page.
One potential issue with this pattern is there is a lot of private variables. While this is sometimes good design, when you want to unit test this code, it might be faster to have these private variables available, so you can manipulate them for the test. You can do this with the revealing module pattern, or the constructor pattern which will expose them.