Skip to content

Instantly share code, notes, and snippets.

@royts
Last active August 10, 2017 05:36
Show Gist options
  • Save royts/9c251737e12d83a45582 to your computer and use it in GitHub Desktop.
Save royts/9c251737e12d83a45582 to your computer and use it in GitHub Desktop.
JavaScript Puzzle
// We need to create a chat client.
// The messages pulling policy to should be:
// 1. Get the latest messages from the server
// 2. Wait 2 sec.
// 3. Back to no. 1 again
// Q: what is wrong with the following solution?
// What would be the right way to do that?
setInterval(function () {
$.getJSON( "http://chat-server.com/10/message", function( data ) {
updateChatWindow(data.messages);
});
}, 2000);
@royts
Copy link
Author

royts commented May 18, 2014

Outbrain is looking for experienced, talented, enthusiastic web developers.
Interested?
Solve this quick puzzle and contact me: rtsabari@outbrain.com

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