-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
main.js
25 lines (19 loc) · 792 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Defining text characters for the empty and full hearts for you to use later.
const EMPTY_HEART = '♡'
const FULL_HEART = '♥'
// Your JavaScript code goes here!
//------------------------------------------------------------------------------
// Don't change the code below: this function mocks the server response
//------------------------------------------------------------------------------
function mimicServerCall(url="http://mimicServer.example.com", config={}) {
return new Promise(function(resolve, reject) {
setTimeout(function() {
let isRandomFailure = Math.random() < .2
if (isRandomFailure) {
reject("Random server error. Try again.");
} else {
resolve("Pretend remote server notified of action!");
}
}, 300);
});
}