Skip to content

Instantly share code, notes, and snippets.

@getanwar
Last active October 2, 2016 18:36
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 getanwar/9046954 to your computer and use it in GitHub Desktop.
Save getanwar/9046954 to your computer and use it in GitHub Desktop.
JS: SIAF Utility Object
//Put into a SIAF
//this type of code will be protected for
//pollution of global functions
//and it can be accessed from the global scope :D
var utility = (function() {
var i = 0;
return {
nameGen: function() {
var name = "Custome Name " + i;
i++;
return name;
}
};
}());
var name1 = utility.nameGen(),
name2 = utility.nameGen(),
name3 = utility.nameGen();
console.log(name1 + " " + name2 + " " + name3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment