Skip to content

Instantly share code, notes, and snippets.

@nicholasshirley
nicholasshirley / js_links
Created October 31, 2016 09:32
Intro JS links
@nicholasshirley
nicholasshirley / JS-links2
Created October 31, 2016 12:32
Second batch of JS intro links
//Square area
https://jsbin.com/durisiq/edit?html,js,console,output
//F to C and C to F
https://jsbin.com/tokifuq/edit?html,js,console,output
//Is divisible
https://jsbin.com/tewarup/edit?html,js,console,output
@nicholasshirley
nicholasshirley / JS-links2
Created October 31, 2016 12:34
Second batch of JS intro links
//Square area
https://jsbin.com/durisiq/edit?html,js,console,output
//F to C and C to F
https://jsbin.com/tokifuq/edit?html,js,console,output
//Is divisible
https://jsbin.com/tewarup/edit?html,js,console,output
@nicholasshirley
nicholasshirley / JS-links3
Created October 31, 2016 13:39
Third set of JS challenge answers
//red, green, yellow
https://jsbin.com/niniza/edit?html,css,js,console,output
//error output
https://jsbin.com/horiva/edit?js,console,output
@nicholasshirley
nicholasshirley / JS-links4
Last active November 1, 2016 12:15
Answers to JS lesson 4 exercises
//min max
https://jsbin.com/zotogo/edit?js,console
//average
https://jsbin.com/wefewoz/edit?js,console
//fizz buzz
https://jsbin.com/yivinaq/edit?js,console
What is scope? Your explanation should include the idea of global vs. local scope.
Scope is the frame in which a variable lives. In JS there are 2 scopes (excluding ES6) global and local. Global variables are availabe to any function and can be called from anywhere (including other files, if loaded first) and local variables are only available inside their function.
Why are global variables avoided?
Global variables are more likely to have unintended side effects. Side effects are when a function reaches outside its scope to change a variable further up the scope chain and unintended indicates that the change is not wanted. If multiple functions are reaching out and changing the same global variable, they can become indeterminate (not produce the same result when run) and lead to bugs.
Explain JavaScript's strict mode
Strict mode, indicated by the 'use strict' at the top of the document (or inside a function), requires variables be explicitly declared before use. One benefit is that if a global variable wou
//Object creator
https://jsbin.com/xupoyil/edit?js,console
//Object updater
https://jsbin.com/honoger/edit?js,console
//Self reference
https://jsbin.com/repacok/edit?js,console
//Deleting keys
https://jsbin.com/nehujej/edit?js,console
//most frequent word
https://jsbin.com/higekon/edit?js,console
//data merge
https://jsbin.com/josoti/edit?js,console
//recipe factory
https://jsbin.com/nizumi/1/edit?html,js,output
//cat carosel
https://jsbin.com/focami/1/edit?js,output
//return of fizzbuzz
https://jsbin.com/bacerap/edit?html,js,output
//lights out
https://jsbin.com/vonugo/1/edit?html,css,js,output
//madlibs
https://hyperdev.com/#!/join/79bdfb66-8fff-43d5-b598-f389797fe738
//cookie parser
https://hyperdev.com/#!/join/070dd322-b44d-49ab-9e45-ab7968b9bdb4