Advertisement
orksnork

Untitled

Jun 9th, 2015
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var tags = {
  2. 1: "the-reality",
  3. 2: "your-life",
  4. 3: "your-voice",
  5. 4: "amped-up"
  6. };
  7.  
  8.  
  9. //Outside of Loop, at top of functionality
  10.  
  11. String.prototype.toTitleCase = function(n) {
  12.    var s = this;
  13.    if (1 !== n) s = s.toLowerCase();
  14.    return s.replace(/\b[a-z]/g,function(f){return f.toUpperCase()});
  15. }
  16.  
  17. //inside the for/each loop
  18.  
  19. var stringArray = tags[i].replace(/-/g, ""); var stringArray = i.toTitleCase();
  20.  
  21. // if tags[i] was initially "the-reality" than stringArray will now = "The Reality"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement