Last active
October 2, 2016 18:36
-
-
Save getanwar/9046954 to your computer and use it in GitHub Desktop.
JS: SIAF Utility Object
This file contains 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
//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