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
// Write a function that takes 3 words and returns a single count of all their letters. | |
function combinedCharacterCount(word1, word2, word3){ | |
var together = word1 + word2 + word3; | |
return together.length; | |
} | |
// Below is a simple assert function and its invocation. Add this to your code and make sure that the test passes. |
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
_.extend = function(obj){ | |
_.each(arguments, function(argObj){ | |
_.each(argObj, function(value, key ){ | |
return obj[key] = value; | |
}); | |
}); | |
return obj; | |
} |
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 salesTeam = [{name: {first: 'aleen', last: 'atkins'}, age: 26, sales: '$2314'}, | |
{name: {first: 'alvaro', last: 'angelos'}, age: 55, sales: '$1668'}, | |
{name: {first: 'denese', last: 'dossett'}, age: 29, sales: '$9248'}, | |
{name: {first: 'douglas', last: 'denney'}, age: 53, sales: '$5058'}, | |
{name: {first: 'earline', last: 'erickson'}, age: 19, sales: '$18876'}, | |
{name: {first: 'herman', last: 'hazell'}, age: 25, sales: '$2746'}, | |
{name: {first: 'homer', last: 'hirth'}, age: 26, sales: '$474'}, | |
{name: {first: 'hwa', last: 'heidt'}, age: 53, sales: '$9607'}, | |
{name: {first: 'hyon', last: 'hampshire'}, age: 46, sales: '$13598'}, |
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
const findLargestLevel = function(node) { | |
var queue = []; | |
node.level = 0; | |
queue.push(node); | |
var current; | |
var largest; |
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 cashAmount = function(value) { | |
// this.value = value; | |
// } | |
// cashAmount.prototype.totalInPennies = function() { | |
// return this.value * 100; | |
// } | |
// const cash = new cashAmount(10.50); | |
// cash.totalInPennies(); // -> 1050 |
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
const hasPathToSum = function(node, targetSum) { | |
// your code here | |
// let search = (node, val) => { | |
// if (node.value === null) { | |
// return; | |
// } | |
// if (val === targetSum) { | |
// return true; |
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 kthSmallest = function(root, k) { | |
var result = []; | |
var search = (node) => { | |
if (node.val !== null) { | |
result.push(node.val); | |
} | |
if (node.left) { | |
search(node.left); | |
} | |
if (node.right) { |
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 productExceptSelf(arr){ | |
var temp = []; | |
var product = 1; | |
for(var i = 0; i < arr.length; i++){ | |
temp[i] = product; | |
product *= arr[i]; | |
} |
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 arr = 'what on earth are you talking about'.split(''); | |
// var vowelDoubler = (str) => { | |
// return str.replace(/[a||e||i||o||u]/gi, myFunc).split(''); | |
// }; | |
var vowelTest = (str) => { | |
if (str.match(/[a||e||i||o||u]/gi)) { | |
return true; |
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
let messageBus = { | |
subscribers: [], | |
publish: (message) => { | |
this.subscribers.forEach((subscriber) => { | |
subscriber.fn(message); | |
}); | |
}, | |
subscribe: (type, subscriber, fn) => { | |
this.subscribers.push({ | |
'type': type, |
OlderNewer