What does this print (in Node or Chrome)?
console.log([] * 1)What does this print (in Node or Chrome)?
console.log([''] * 1)| class LinkedList { | |
| constructor() { | |
| this.head = null; | |
| this.tail = null; | |
| } | |
| add(value) { | |
| const node = { value }; | |
| if (this.tail != null) { | |
| this.tail.next = node; |
| [ | |
| { | |
| "answer": "pure", | |
| "choices": ["impure", "pure"], | |
| "function": "const sums = (a,b) => {return a+b}", | |
| "question": "Is the following function pure or impure?" | |
| }, | |
| { | |
| "answer": "O(b)", | |
| "choices": ["O(a + b)", "O(ab)", "O(a)", "O(b)"], |
| function buildGraph(edges) { | |
| let graph = Object.create(null); | |
| function addEdge(from, to) { | |
| if (graph[from] == null) { | |
| graph[from] = [to]; | |
| } else { | |
| graph[from].push(to); | |
| } | |
| console.log(from, to); | |
| console.log(graph[from]); //vs console.log(graph); why does printing the entire graph here print the completed graph on the second call, even though it shouldn't be fully constructed until the last call? |
| 'use strict'; // for ES6 in node | |
| /*eslint arrow-body-style: 0*/ | |
| const gulp = require('gulp'); | |
| const source = require('vinyl-source-stream'); | |
| const browserify = require('browserify'); | |
| const watchify = require('watchify'); | |
| const resolutions = require('browserify-resolutions'); | |
| const eslint = require('gulp-eslint'); | |
| const path = require('path'); |
| # Path to your oh-my-zsh installation. | |
| export ZSH=$HOME/.oh-my-zsh | |
| # Set name of the theme to load. | |
| # Look in ~/.oh-my-zsh/themes/ | |
| # Optionally, if you set this to "random", it'll load a random theme each | |
| # time that oh-my-zsh is loaded. | |
| ZSH_THEME="robbyrussell" | |
| # Example aliases |
| var async = require('async'); | |
| var data = [ | |
| {timeout: 43, text: 'taco bell'}, | |
| {timeout: 26, text: 'twelve'}, | |
| {timeout: 340, text: 'kfC'} | |
| ]; | |
| var counter = 0; | |
| var iterator = function (item, callback) { |
| Name Command State Ports | |
| ------------------------------------------------------------------------- | |
| ec2user_api_1 node server.js Exit 0 0.0.0.0:8080->80 | |
| 80/tcp | |
| ec2user_courses_ node server.js Exit 0 0.0.0.0:443->443 | |
| 1 /tcp, 0.0.0.0:80 | |
| ->80/tcp | |
| ec2user_mongo_1 /entrypoint.sh Exit 0 0.0.0.0:27017->2 | |
| mongod 7017/tcp | |
| ec2user_redis_1 /entrypoint.sh Exit 0 6379/tcp |
| var _ = require('highland'); | |
| var cheerio = require('cheerio'); | |
| var request = require('request'); | |
| // request library, but with a node.js style callback - i.e. (err, res) | |
| var req = function (url, cb) { | |
| request(url, function (err, res, data) { | |
| cb(err, data); | |
| }); | |
| }; |