Skip to content

Instantly share code, notes, and snippets.

View dsdunn's full-sized avatar

David Starr Dunn dsdunn

View GitHub Profile
const http = require('http');
const url = require('url');
const server = http.createServer();
let messages = [
{ 'id': 1, 'user': 'Cardi B', 'message': 'I got money!'},
{ 'id': 2, 'user': 'the Munchkins', 'message': 'ding dong the witch is dead'},
{ 'id': 3, 'user': 'bart simpson', 'message': 'don\'t have a cow, man'}
];
const isOverTen = (num) => {
return new Promise((resolve, reject) => {
if (num > 10) {
resolve(num + ' is greater than 10')
} else reject(num + ' is less than or equal to ten')
});
}
const makeCaps = (arr) => {
return new Promise((resolve, reject) => {