Created
          July 19, 2012 03:17 
        
      - 
      
 - 
        
Save glauberramos/3140536 to your computer and use it in GitHub Desktop.  
    Bad javascript code - Example for blog post - Remove Unuseful Code
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | function book(name, author, content, date) { | |
| var name = name, | |
| author = author, | |
| content = content, | |
| date = date; | |
| var self = { | |
| containsWord: function(word) { | |
| return content.indexOf(word) >= 0; | |
| }, | |
| removeWord: function(word) { | |
| return self.replaceWord(word, ''); | |
| }, | |
| replaceWord: function(oldWord, newWord) { | |
| return content.replace(oldWord, newWord); | |
| }, | |
| getName: function() { return name; }, | |
| getAuthor: function() { return author; }, | |
| getContent: function() { return content; }, | |
| getDate: function() { return date; } | |
| }; | |
| return self; | |
| }; | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment