Skip to content

Instantly share code, notes, and snippets.

@emphaticsunshine
Created August 13, 2012 23:15
Show Gist options
  • Save emphaticsunshine/3344729 to your computer and use it in GitHub Desktop.
Save emphaticsunshine/3344729 to your computer and use it in GitHub Desktop.
With block javascript
var person ={
"employee":{
"name": "Mohit Seth",
"role": "Javascript Developer"
}
}
/*this should be avoided*/
with(person.employee){
console.log(name,role);
}
/* This is better way to do it */
var obj = person.employee;
console.log( obj.name, obj.role);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment