Skip to content

Instantly share code, notes, and snippets.

@glauberramos
Created July 19, 2012 02:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glauberramos/3140383 to your computer and use it in GitHub Desktop.
Save glauberramos/3140383 to your computer and use it in GitHub Desktop.
Bad javascript code - Example for blog post - Identation
//this function represents a book from an online library
//it has 3 methods to search the book, remove a specific word and change it
//it has 4 attributes, name, author, date and content
//creates libaries stuffz
function elementliBRaryContent(a,b,c,d) {
var bnam = a;
var baut = b;
var bdat = c;
var bcont = d;
var self = {
findword: function(x) {
return bcont.indexOf(x)>=0;
},
findremword: function(y) {
return bcont.indexOf(y)>=0?bcont.replace(y + ' ',''):bcont;
},
findrepword: function(z,w) {
return bcont.indexOf(z)>=0?bcont.replace(z,w):bcont;
},
getbnam: function() {return bnam;},
getbaut: function() {return baut;},
getbdat: function() {return bdat;},
getbcont: function() {return bcont;}
};
return self;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment