Last active
August 10, 2017 05:36
-
-
Save royts/9c251737e12d83a45582 to your computer and use it in GitHub Desktop.
JavaScript Puzzle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Outbrain is looking for experienced, talented, enthusiastic web developers.
Interested?
Solve this quick puzzle and contact me: [email protected]