Skip to content

Instantly share code, notes, and snippets.

// Backend
const kitchen = order => {
let result = new Promise((resolve, reject) => {
console.log(`Cooking ${order}`); // 2
setTimeout(() => {
if (order === "Rocky Mountain Oysters") {
reject("Please Leave! No Soup for you!");
} else {
console.log(`${order} prepared`); // 3
resolve({ food: `Cooked ${order}`, msg: "Thanks for stopping by" });

Keybase proof

I hereby claim:

  • I am comanjo on github.
  • I am comanjo (https://keybase.io/comanjo) on keybase.
  • I have a public key ASCfwOgbeOMsAACMcZSz-aj5gsQDKIj0zvEO-mJpIH4ewwo

To claim this, I am signing this object:

// 10: destructuring - array
// To do: make all tests pass, leave the assert lines unchanged!
describe('destructuring arrays makes shorter code', () => {
it('extract value from array, e.g. extract 0 into x like so `let [x] = [0];`', () => {
let firstValue = 1;
assert.strictEqual(firstValue, 1);
});
// 2: template strings - multiline
// To do: make all tests pass, leave the asserts unchanged!
describe('template string, can contain multiline content', function() {
it('a normal string can`t span across multiple lines', function() {
var normalString = 'line1\nline2'
;
assert.equal(normalString, 'line1\nline2');
});
// 1: template strings - basics
// To do: make all tests pass, leave the asserts unchanged!
describe('a template string, is wrapped in ` (backticks) instead of \' or "', function() {
describe('by default, behaves like a normal string', function() {
it('just surrounded by backticks', function() {
var str = `like a string`;
assert.equal(str, 'like a string');