Skip to content

Instantly share code, notes, and snippets.

@clemmy
Last active November 14, 2017 02:45
Show Gist options
  • Save clemmy/f0de896e4853172d88f664ab23c517d9 to your computer and use it in GitHub Desktop.
Save clemmy/f0de896e4853172d88f664ab23c517d9 to your computer and use it in GitHub Desktop.
{{ a: 1 }} // { a: 1 }
{
  ({ a: 1 })
} // { a: 1 }
{ { a: 1 } 5; } // 5
{
  let x = 5;
  { a: 1 }
} // 5
{
  for (var i=0; i<2; ++i) i;
} // 1
{
  a:
  while (true) {
    break a;
  }
  5;
} // 5
{
  var a = true;
  if (a) 1;
  else 2;
} // 1
{
  var a = true;
  if (a) yield 1;
  else yield 2;
} // [1]
{
  yield null;
} // [null]
{
  const identity = (i) => { return i; }
  for (var i=0; i<5; ++i) {
    yield identity(i);
  }
} // [0, 1, 2, 3, 4]
{
  for (var i=0; i<5; ++i) {
    if (i === 2) continue;
    yield identity(i);
  }
} // [0, 1, 2, 3, 4]
{
  a:
  for (var i=0; i< 5; ++i) {
    for (var j=20; j<25; ++j) {
      if (j === 21) {
        continue a;
      }
      yield i + ' ' + j
    }
  } // [0 20, 1 20, 2 20,  3 20, 4 20]
}
{
  break;
} // error
{
  return;
} // error
{
  continue;
} // error
<div {...{a:1}} /> // React.createElement('div', {a:1})
{
  () => 1
} // () => 1
{
  function *() { 1; }
} // function* () { 1; }
{
  class foo {}
} // class foo {}
{[1]} // [1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment