Skip to content

Instantly share code, notes, and snippets.

View johnayoung's full-sized avatar

John Young johnayoung

View GitHub Profile
'use strict';
// Request and response object drills
// ==================================
const express = require('express');
const app = express();
// use express middleware to parse the request body and add it to the request object
// don't worry, you'll learn all about middleware in the next assignment!
@johnayoung
johnayoung / john-jordan-in-your-own-words.md
Created December 4, 2018 16:50
John Young and Jordan Heffernan 'In your own words' exercise.

1. What is scope? Your explanation should include the idea of global vs. local scope

Scope is part of the reasoning of how code works in regards to variables. Global scope allows accessing variables everywhere, whereas local scope is bound to the block at which it is defined.

2. Why are global variables avoided?

Global variables are avoided to prevent unintended side effects.

3. Explain JavaScript's strict mode

#Convert JSON file to an object
$JsonParameters = ConvertFrom-Json -InputObject $content
#Create new PSObject with no properties
$oData = New-Object PSObject
#Loop through properties of the $JsonParameters.parameters object, and add them to the new blank object
$JsonParameters.parameters.psobject.Properties.Name |
ForEach{
Add-Member -InputObject $oData -NotePropertyName $_ -NotePropertyValue $JsonParameters.parameters.$_.Value
@johnayoung
johnayoung / tech-eval-notes.md
Last active November 7, 2018 14:48
Notes to prepare for the Thinkful tech evaluation

HTML

Front-end first steps

  • Creating HTML and CSS files, and linking to a CSS file inside of HTML
  • Structuring a simple project folder
  • Using VS Code to create and edit files
  • Inserting the boilerplate code that all HTML pages need

HTML the right way

  • Describing the difference between HTML elements, tags, and attributes
  • Explaining what is meant when people say HTML is about structure (vs. presentation or behavior)
function getTokens(rawString) {
// This first function does the following things:
// - Takes a raw string
// - Converts the entire string to lowercase
// - Splits all words into an array that do not match a single character specified between the []
// - Removes falsy items
// - Sorts the array of strings in place
return rawString.toLowerCase().split(/[ ,!.";:-]+/).filter(Boolean).sort();
}

What is scope? Your explanation should include the idea of global vs. local scope.

Scope determines the level at which variables can be accessed and modified. Scope is determined by the scope chain, which is the standard for determining the scope of variables.

Local scope refers to the lowest level of the scope chain, and typically refers to block level (ie, inside levels of a function. Global scope refers to the highest level of the scope chain, and can be accessed across not only the current file, but all files across the app.

Why are global variables avoided?

min and max (without sort) drill
https://repl.it/@johnatspreadstr/min-and-max-without-sort-drill
average drill
https://repl.it/@johnatspreadstr/average-drill
fizzbuzz drill js
https://repl.it/@johnatspreadstr/fizzbuzz-drill-js