Top Banner
The DrBoolean Boolean Challenge Judge: DrBoolean (Brian) Host: Taylor
38

Functional Monthly 8: DrBoolean Boolean Challenge

May 21, 2015

Download

Technology

Taylor Smith

At the recent Functional Monthly meetup hosted by San Francisco JavaScript Meetup, we put together a little game show to teach people some programming.

Learn about functional programming, JavaScript in general, and weird trivia.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Functional Monthly 8: DrBoolean Boolean Challenge

The DrBoolean Boolean Challenge

Judge: DrBoolean (Brian) Host: Taylor

Page 2: Functional Monthly 8: DrBoolean Boolean Challenge

ContestantsMatt Schmulen Erwan Guyader

chosen from people that registered online

RulesHold up TRUE or FALSE card for each question. Person at

the end with the most points, wins.

Page 3: Functional Monthly 8: DrBoolean Boolean Challenge

HelpEach contestant gets 3 “ask the audience” helps.

1) The other player must answer first 2) The audience will be asked the question 3) The helpee will get to choose their answer.

Page 4: Functional Monthly 8: DrBoolean Boolean Challenge

Home Game!people in audience

Rules#sfjsfunc with your answer to as many

questions as you can.

EX: #sfjsfunc 0 TRUE

We’ll pick one person with some right answers to win something nice before the next meetup.

Page 5: Functional Monthly 8: DrBoolean Boolean Challenge

Warm Up Question 0

TRUE || FALSE

Page 6: Functional Monthly 8: DrBoolean Boolean Challenge

Warm Up Answer 0

TRUE

Page 7: Functional Monthly 8: DrBoolean Boolean Challenge

Question 1

(function() { return typeof arguments })() !//=> “object”

Page 8: Functional Monthly 8: DrBoolean Boolean Challenge

Answer 1

TRUE

The type of arguments is an "array-like" object.

Page 9: Functional Monthly 8: DrBoolean Boolean Challenge

Question 2x = “hello”.toUpperCase !x.call(“World”) !//=> “WORLD”

Page 10: Functional Monthly 8: DrBoolean Boolean Challenge

Answer 2

TRUE

Grab the method off of the "hello" string and store in x. Using "call" changes the context (this) to the passed in argument - in this case "world".

Page 11: Functional Monthly 8: DrBoolean Boolean Challenge

Question 3

JavaScript was originally named HyperScript

Page 12: Functional Monthly 8: DrBoolean Boolean Challenge

Answer 3

FALSEIt was called Mocha then quickly changed to LiveScript

Page 13: Functional Monthly 8: DrBoolean Boolean Challenge

Question 4

3 + 2 + 2 + ‘1’; !

//=> ’8'

Page 14: Functional Monthly 8: DrBoolean Boolean Challenge

Answer 4

FALSE, “71”It will be 71 since it adds the numbers to get 7, then does an implicit type coercion and appends the string "1" to 7.

Page 15: Functional Monthly 8: DrBoolean Boolean Challenge

Question 5

JavaScript has been a trademark of Sun Microsystems.

Page 16: Functional Monthly 8: DrBoolean Boolean Challenge

Answer 5

TRUEThough Oracle recently bought Sun so it's now Oracle. That's right, it's owned by "the man".

Page 17: Functional Monthly 8: DrBoolean Boolean Challenge

Question 6Foo = function() {} !var a = new Foo() !Foo.prototype.what = “fp rulez lol” !a.what //=> “fp rulez lol”

Page 18: Functional Monthly 8: DrBoolean Boolean Challenge

Answer 6

TRUEDoesn't matter if the prototype method is defined after an instance is created as it looks directly at the inheritance chain.

Page 19: Functional Monthly 8: DrBoolean Boolean Challenge

Question 7Foo = function() {} !var a = new Foo() !Foo.prototype.what = “fp rulez lol” !delete a.what !a.what //=> undefined

Page 20: Functional Monthly 8: DrBoolean Boolean Challenge

Answer 7

FALSE

It will return "fp rulez lol". You can't delete a prototype method off the constructor by deleting it on an instance.

Page 21: Functional Monthly 8: DrBoolean Boolean Challenge

Question 8function() { if(true) { var a = 5; } alert(a); } !//=> Error! a is undefined

Page 22: Functional Monthly 8: DrBoolean Boolean Challenge

Answer 8

FALSEThere is no block scope in the if statement so 'a' is defined as 5

Page 23: Functional Monthly 8: DrBoolean Boolean Challenge

Question 9

Object.prototype.name = “King”; !var name = “Ralph”; !with ({}) { console.log(name) ; } !//=>“Ralph”

Page 24: Functional Monthly 8: DrBoolean Boolean Challenge

Answer 9

FALSEIt will be "King". The 'with' fn changes the context and name is found on the object via the prototype. Weird.

Page 25: Functional Monthly 8: DrBoolean Boolean Challenge

Question 10

John Resig is working on the study of Ukiyo-e (Japanese Woodblock printing)

Page 26: Functional Monthly 8: DrBoolean Boolean Challenge

Answer 10

TRUEGo figure

Page 27: Functional Monthly 8: DrBoolean Boolean Challenge

Question 11

f = function(){ return this + 1} g = f.bind(2) !g(5) //=> 6

Page 28: Functional Monthly 8: DrBoolean Boolean Challenge

Answer 11

FALSE

It forever bound 'this' to 2

Page 29: Functional Monthly 8: DrBoolean Boolean Challenge

Question 12

function f(){ return f; } new f() instanceof f;

Page 30: Functional Monthly 8: DrBoolean Boolean Challenge

Answer 12

FALSEf() returns f so it's not an instance of itself.

Page 31: Functional Monthly 8: DrBoolean Boolean Challenge

Question 13

Crockford has a degree in meteorology from Clayton State University

Page 32: Functional Monthly 8: DrBoolean Boolean Challenge

Answer 13

FALSEHe has a degree in TV and Radio from SF State. duh.

Page 33: Functional Monthly 8: DrBoolean Boolean Challenge

Question 14

[] + []; !

//=> “”

Page 34: Functional Monthly 8: DrBoolean Boolean Challenge

Answer 14

TRUEWat. Sadly.

Page 35: Functional Monthly 8: DrBoolean Boolean Challenge

Question 15

function Person(n) { this.name = n } !var p = Person(“Gary”) !p.name //=> Gary

Page 36: Functional Monthly 8: DrBoolean Boolean Challenge

Answer 15

FALSEForgot the "new" keyword and the constructor doesn't use fancy tricks to help with that.

Page 37: Functional Monthly 8: DrBoolean Boolean Challenge

Question 16: BONUS

In the 1995 adventure, ‘Jumanji’, what was Robin Williams’ character’s name.

Points: 1 for first or last name 5 for full name

Page 38: Functional Monthly 8: DrBoolean Boolean Challenge

Answer 3

Alan ParrishTypeerror! Couldn't match expected type `Bool' with actual type `[Char]'