Skip to content

Instantly share code, notes, and snippets.

@jeffmarshall
Last active August 29, 2015 14:01
Show Gist options
  • Save jeffmarshall/a0736598927c0c41c376 to your computer and use it in GitHub Desktop.
Save jeffmarshall/a0736598927c0c41c376 to your computer and use it in GitHub Desktop.
Javascript 'with'
// without
var x = Math.cos(3 * Math.PI) + Math.sin(Math.LN10);
var y = Math.tan(14 * Math.E);
// with
with (Math){
var x = cos(3 * PI) + sin (LN10);
var y = tan(14 * E);
}
// from http://msdn.microsoft.com/en-us/library/ie/b294afx9(v=vs.94).aspx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment