const result = [1,2,3].reduce((acc,value) => acc+value, 0);
// result is 6
console.log(result);
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
| rp(options) | |
| .then(function ($) { | |
| var titles = $('div > div > div.title.align-top > a'); | |
| var urls = titles.map(function (index, div) { // collecting urls | |
| return $(div).attr('href') | |
| }) | |
| var requests = urls.map(function (index, url) { // creating promises from requests on urls | |
| return rp(root + url) // .then(turnIntoInstances); | |
| }) |
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
| @values = [ | |
| [1000, 'M'], | |
| [500, 'D'], | |
| [100, 'C'], | |
| [50, 'L'], | |
| [10, 'X'], | |
| [5, 'V'], | |
| [1, '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
| .parent { | |
| width: 100%; | |
| height: 350px; | |
| outline: 1px solid black; | |
| display: flex; | |
| flex-direction: row; | |
| justify-content: space-around; | |
| /* align-items: baseline; */ | |
| /* flex-wrap: wrap-reverse; */ | |
| flex-flow: row nowrap; |
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
| require 'active_support/all' | |
| @candidates = [ | |
| { | |
| id: 5, | |
| years_of_experience: 4, | |
| github_points: 293, | |
| languages: ['C', 'Ruby', 'Python', 'Clojure'], | |
| date_applied: 5.days.ago.to_date, | |
| age: 26 |
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 game = { | |
| userAmount: 100, | |
| bet: null, | |
| number: null, | |
| guess: null, | |
| getBetAmount: function() { | |
| //RB: Question - what does 'this' refer to? Do look up the different rules for 'this' (we can discuss further next time). | |
| //RB: The approach to using this is not wrong, however, you can also just refer to globally defined variables (to reduce writing 'this') |
const initialState = {
visibilityFilter: VisibilityFilters.SHOW_ALL,
todos: []
}
function todoApp(state = initialState, action) {
switch (action.type) {
case SET_VISIBILITY_FILTER:
return Object.assign({}, state, {import { combineReducers } from 'redux'
function todos(state = [], action) {
switch (action.type) {
case ADD_TODO:
return [
...state,
{
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <script src="jquery-3.1.0.js"></script> | |
| </head> | |
| <body> | |
| <h1>Place Your Bets!</h1> | |
| <!--RB: You can remove this extra space, lint takes care of this, http://eslint.org/--> |
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
| { | |
| "window.zoomLevel": 0, | |
| "editor.minimap.enabled": false, | |
| "editor.tabSize": 2, | |
| "workbench.settings.editor": "json", | |
| "eslint.validate": [ | |
| "javascript", | |
| "javascriptreact", | |
| { | |
| "language": "typescript", |
OlderNewer