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 _ = require("lodash"); | |
var worker = function(users) { | |
return _.where(users, {active: true}); | |
}; | |
module.exports = worker; |
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
// -> Create an object called 'robot' using an object literal | |
// -> robot should have a property 'smart' with value true | |
var robot = { | |
smart: true | |
}; | |
// -> Claim the result robot.smart | |
claim(robot.smart, 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
function identity(args) { | |
return args; | |
} | |
module.exports = identity; |
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
//Using setTimeout, print the string 'TIMED OUT!' after 300ms. | |
setTimeout(() => { | |
console.log('TIMED OUT!') | |
}, 300) |
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
//Exercise 2 Separation of Concerns 1 | |
//Separation of Concerns Part 1 | |
/*take the 4 methods and any variables that relate to | |
balance management and move them to balanceManager.js. Then, back in | |
vendingMachine.js, change the method of calling those functions from this | |
to our new balanceManager | |
*/ | |
var balance = 0; |
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
//Exercise 5 [_.chain(value)] | |
/*We have a list of words that we want to modify. | |
['Test', 'Hello', 'World', 'Node', 'JavaScript'] | |
We want to modify each word so that they are all appended with the word Chained, converted to uppercase, and sorted by alphabetical order. The result should look like this: | |
['HELLOCHAINED', 'JAVASCRIPTCHAINED', 'NODECHAINED', 'TESTCHAINED', 'WORLDCHAINED'] | |
*/ |
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
//Exercise 11 | |
/*Export a function that takes a string argument and returns whether the string starts with `cat`, `dog`, or `robot` followed by a number to the end of the string | |
*/ | |
module.exports = function (str) { | |
return /^(cat|dog|robot)\d+$/.test(str); | |
} |
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
/*Exercise 1 | |
Create an Express.js app that outputs "Hello World!" when somebody goes to /home.The port number will be provided to you by expressworks as the first argument ofthe application, i.e., process.argv[2] | |
*/ | |
var express = require('express') | |
var app = express() | |
app.get('/home', function(req, res) { | |
res.end('Hello World!') | |
}) | |
app.listen(process.argv[2]) |
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
// Exercise 1 | |
/** | |
Create a javascript program that takes the the first command-line argument and | |
outputs it right after a "Hello " String using ES6 template strings | |
*/ | |
var arg = process.argv[2]; | |
console.log(`Hello ${arg}`); |
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
registry = http://localhost:15443/ | |
userconfig = /home/anna/.config/how-to-npm/npmrc |