Created
August 1, 2013 23:03
-
-
Save omniosi/6136121 to your computer and use it in GitHub Desktop.
explaining how to lock your variables and functions to this code alone to make sure there is no interference with other code on the page or site.
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Name spacing</title> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
var namespace = { | |
firstname: 'Ornette', | |
lastname: 'Coleman', | |
doSomething:function(){ | |
//add code here | |
} | |
} | |
console.log('Your name is '+namespace.firstname+' '+namespace.lastname+'.'); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment