This file contains hidden or 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
var http = require('http'); | |
const storedValues = {}; | |
http.createServer((request, response) => { | |
// check path is supported | |
const path = request.url.split('?'); | |
if (!path || path.length !== 2) { | |
response.writeHead(404); |
This file contains hidden or 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
function depthFirstSearch(tree, searchTerm) { // accepts standard object | |
if (typeof searchTerm === 'number') { | |
searchTerm = String(searchTerm); | |
} | |
if (typeof searchTerm !== 'string') { | |
return null; | |
} | |
const objKeys = Object.keys(tree); |