Skip to content

Instantly share code, notes, and snippets.

@newhouseb
Created September 18, 2011 09:30
Show Gist options
  • Save newhouseb/1224905 to your computer and use it in GitHub Desktop.
Save newhouseb/1224905 to your computer and use it in GitHub Desktop.
Every possible form of syntax in JS
true;
null;
NaN;
undefined;
21.2;
"hello";
window;
([1,2,3]);
({ a:2, 'b':3});
/1/g;
i = 0;
i += 1;
i -= 1;
i *= 1;
i /= 1;
i %= 3;
i != 4;
true || false;
true && false;
!true;
a == 2;
a === 3;
true == ~false;
a > 2;
a < 3;
a >= 5;
a <= 5;
a >> 2;
a << 2;
a >>> 3;
true ^ false;
i;
1 - 3;
i++;
--i;
console.log('test');
[1][0];
1, 2;
1 ? 2 : 3;
(function() {});
new (function(){})();
{ insideablock };
if(1) { } else if(0) { } else { elsa };
with({}) {};
var i = 0;
function foo() {};
(function() { return 3 });
try {tried} catch(e) {caguht} finally {intheend};
throw 1;
do {} while(0);
for(var i = 0; i < 0; i++) {};
for(i in []) {};
switch(i) { case 2: 4; break; case 3: 5; break; };
while(0) {};
alabel : while(0) { break alabel };
blabel : while(0) { continue blabel };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment