Skip to content

Instantly share code, notes, and snippets.

@remy
Created November 30, 2012 13:23
Show Gist options
  • Save remy/4175723 to your computer and use it in GitHub Desktop.
Save remy/4175723 to your computer and use it in GitHub Desktop.
How to hang JavaScript (useful - to me - for slowing down code and testing)
function hang(n) {
var x = new XMLHttpRequest();
x.open('GET', 'http://hang.nodester.com/script.js?' + n, false);
x.send();
}
// usage: hang(2 * 1000);
@remybach
Copy link

Totally non-essential, but I saw Paul Irish denote seconds as milliseconds by doing 2e3 rather than 2 * 1000 which I thought was pretty cool.

@Francisc
Copy link

It is cool, ha.

@Saya47
Copy link

Saya47 commented Oct 7, 2019

that website is down :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment