Last active
January 18, 2019 15:04
-
-
Save julia-r/7d8eceec586cc20718854cab4fd3ef7d to your computer and use it in GitHub Desktop.
The first commented line is your dabblet’s title
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
/** | |
* The first commented line is your dabblet’s title | |
*/ | |
background: #f06; | |
background: linear-gradient(45deg, #f06, yellow); | |
min-height: 100%; |
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
<!-- content to be placed inside <body>…</body> --> |
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
// Returns: Counting A... - A 1 - A 2 - A3 | |
/* var count = function(){ | |
console.log("Counting A..."); | |
console.log("A 1"); | |
console.log("A 2"); | |
console.log("A 3"); | |
}();*/ | |
// Returns: Counting B... - B1 - B3 - B2 | |
/*var count2 = function(){ | |
console.log("Counting B..."); | |
console.log("B1"); | |
setTimeout(function(){ console.log("B2"); },1000); | |
console.log("B3"); | |
}();*/ | |
var count3 = function(){ | |
console.log("Counting C..."); | |
console.log("C1"); | |
let myPromise = new Promise((resolve, reject) => { | |
setTimeout(function(){ console.log("C2.a"); resolve("C2.b"); }, 1000); | |
}) | |
.then((num) => { | |
console.log("Yay! " + num); | |
console.log("C3"); | |
}); | |
}; | |
//count3(); | |
var count4 = function(){ | |
console.log("Counting D..."); | |
console.log("D1"); | |
let myPromise = new Promise((resolve, reject) => { | |
setTimeout(function(){ console.log("D2.a"); resolve ("D2.b"); }, 1000); | |
}) | |
.then((num) => { | |
console.log(num); | |
console.log("D3"); | |
setTimeout(function(){ console.log("D4.a"); return ("D4.b"); }, 1000); | |
}) | |
.then((num) => { | |
console.log(num); | |
console.log("D5"); | |
}); | |
}; | |
//count4(); | |
var count5 = function(i){ | |
console.log("Testing..."); | |
let myPromise = new Promise((resolve, reject) => { | |
if (i < 10){ | |
resolve("Success"); | |
} | |
else { | |
reject("Error"); | |
} | |
}) | |
.catch((value) => { | |
console.error("error", value); | |
}) | |
.then((result) => { | |
console.log("then: ", result); | |
}); | |
}; | |
//count5(15) |
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
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"javascript"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment