SlideShare a Scribd company logo
PeopleSpace 23 August 2016
The JavaScript You Wished
You Knew
Troy Miles
Troy Miles
Speaker and author
https://
therockncoder.com/
rockncoder@gmail.com
@therockncoder
@therockncoder
Please follow me on twitter
Have MEAN October
October 15th & 16th
MongoDB, Express.js, Angular, and Node
Build a full stack site using the latest versions
Only $195
http://peoplespace.us/javascript/
Resources
http://www.slideshare.net/rockncoder/the-javascript-
you-wished-you-knew
https://github.com/Rockncoder/JSFoundations
Agenda
The big lie
What is this?
function, function, function
call, apply, and bind
high order functions
closure
splice vs slice
strict mode
map, filter, and reduce
arrow functions
array.from
Summary
The big lie
Brendan Eich was hired to create Scheme for the
browser
It was released in Sept. 1995 as LiveScript
It was renamed JavaScript in Dec. 1995
At the time NetScape and Sun were partners
Sun owned the trademark, JavaScript
(What is Scheme?)
Scheme is a functional language in the LISP family
Some of the features of JavaScript like high order
functions and closures come from its Scheme mother
Bad math
JavaScript doesn’t have multiple kinds of numbers
This means we are vulnerable to some shortcomings of
base-2 numbers
What is this?
this is a keyword
You can’t directly modify it
It is the context in which the code is running
(It was the dumbest possible name for a keyword)
function, function, function
The secret parameters
Every function receives two secret parameters
this - which points to the current context
arguments - an array-like structure holding all of the
passed parameters
Every function returns a
value
If a function lacks a return statement, the function
returns “undefined”
undefined is a primitive type in JavaScript
It can be used to compare in strict equalities
Better to use typeof since it won’t throw an error
4 ways to invoke a function
1. As a function
2. As a method of an object
3. As a function constructor
4. Using call or apply
call, apply
call and apply are very similar
both allow you to set both of the secret parameters
call accepts a list of parameters for the arguments
apply takes an array for the arguments
Remember: A is for array, arguments, & apply
bind
Bind is weird
It creates a new function based on an older one
It permanently assigns a this to the new function
Remember: it binds this to the the function
high order functions
Functions are first class objects in JavaScript
Any place you use a variable, you can substitute with a
function
You can pass functions to functions
And return functions from functions
What is a closure?
A closure is a function which remembers the
environment in which it was created
This is super-powerful and enables JavaScript to do
things not possible in other language
ES3
splice vs. slice
Both introduced in ES3(1999)
The splice() method changes the content of an array by
removing existing elements and/or adding new
elements.
The slice() method returns a shallow copy of a portion
of an array into a new array object.
splice is DESTRUCTIVE
arguments
arguments is array-like since it has a length property
but it is not an array because it doesn’t have any of the
array methods
to convert it to an array is easy
ES5
strict mode
“use strict”; or ‘use strict’;
Must be the first statement in a file or function
Turns on “ES5” mode
JavaScript becomes more strict
map, filter, reduce
map - transform one array into another
filter - checks every value of an array, creating a new
array
reduce - turns an array into a scalar value
array methods
most array methods are passed the same three
parameters, in the same order
element - the current value
index - the current array index
array - the entire array
ES6 / ES2015
array.from
Creates a new array from array like objects or iterators
Can turn arguments, strings, and others into arrays
Can generate arrays based on values passed in
arrow function
a short form of the anonymous function
Captures the this of its parent code
Best for non-method code
In short form, it does an implicit return
In long form, you must include a return statement
Resources
http://www.slideshare.net/rockncoder/the-javascript-
you-wished-you-knew
https://github.com/Rockncoder/JSFoundations
The End

More Related Content

PPTX
Evaluation of prefix expression with example
PPTX
Qtp training session IV
PDF
Advanced Reflection in Pharo
PPTX
Introduction to RxJava on Android
PDF
Signal ing out of callback hell
PDF
Working of Merge Sort Code
PPTX
Introduction to stack
PDF
Jfokus functional groovy
Evaluation of prefix expression with example
Qtp training session IV
Advanced Reflection in Pharo
Introduction to RxJava on Android
Signal ing out of callback hell
Working of Merge Sort Code
Introduction to stack
Jfokus functional groovy

What's hot (20)

PDF
Apollo Server III
PDF
RxJava@Android
PDF
簡単にレビュー環境が作れる仕組みを作ってる話し
PDF
Lambdas HOL
PPTX
Stack project
PPTX
Functional programming (Let's fall back in love with Programming)
PPTX
Effective c# part1
PDF
The Mayans Lost Guide to RxJava on Android
PPT
Module 3: Introduction to LINQ (PowerPoint Slides)
PPTX
Mca ii dfs u-3 linklist,stack,queue
PPT
PPTX
2CPP08 - Overloading and Overriding
PPTX
Link quries
PPTX
Linq
PDF
Lambda expression par Christophe Huntzinger
ODP
OCL 2.4. (... 2.5)
PPT
Stacks overview with its applications
PPTX
Introduction of basics loop and array
PPT
Stack a Data Structure
Apollo Server III
RxJava@Android
簡単にレビュー環境が作れる仕組みを作ってる話し
Lambdas HOL
Stack project
Functional programming (Let's fall back in love with Programming)
Effective c# part1
The Mayans Lost Guide to RxJava on Android
Module 3: Introduction to LINQ (PowerPoint Slides)
Mca ii dfs u-3 linklist,stack,queue
2CPP08 - Overloading and Overriding
Link quries
Linq
Lambda expression par Christophe Huntzinger
OCL 2.4. (... 2.5)
Stacks overview with its applications
Introduction of basics loop and array
Stack a Data Structure
Ad

Similar to The JavaScript You Wished You Knew (20)

PPTX
Introduction to es6
PPTX
Introduction to Ecmascript - ES6
PDF
Important JavaScript Concepts Every Developer Must Know
PPTX
React & Redux JS
PPS
Learn java
PDF
Design patterns
PPTX
Why Functional Programming So Hard?
PDF
A Brief, but Dense, Intro to Scala
PDF
Functional JavaScript Fundamentals
PDF
Scala tutorial
PDF
Scala tutorial
PPTX
WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD?
PPTX
JavaScript.pptx
PDF
ES6 presentation
PPTX
Intro to ES6 and why should you bother !
PPTX
js.pptx
PPT
Douglas Crockford Presentation Goodparts
PPT
Scala Days San Francisco
PPTX
JavaScript OOPS Implimentation
DOCX
Java mcq
Introduction to es6
Introduction to Ecmascript - ES6
Important JavaScript Concepts Every Developer Must Know
React & Redux JS
Learn java
Design patterns
Why Functional Programming So Hard?
A Brief, but Dense, Intro to Scala
Functional JavaScript Fundamentals
Scala tutorial
Scala tutorial
WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD?
JavaScript.pptx
ES6 presentation
Intro to ES6 and why should you bother !
js.pptx
Douglas Crockford Presentation Goodparts
Scala Days San Francisco
JavaScript OOPS Implimentation
Java mcq
Ad

More from Troy Miles (20)

PDF
Fast C++ Web Servers
PDF
Node Boot Camp
PDF
AWS Lambda Function with Kotlin
PDF
React Native One Day
PDF
React Native Evening
PDF
Intro to React
PDF
React Development with the MERN Stack
PDF
Angular Application Testing
PDF
ReactJS.NET
PDF
What is Angular version 4?
PDF
Angular Weekend
PDF
From MEAN to the MERN Stack
PDF
Functional Programming in JavaScript
PDF
Functional Programming in Clojure
PDF
MEAN Stack Warm-up
PDF
Game Design and Development Workshop Day 1
PDF
Build a Game in 60 minutes
PDF
Quick & Dirty & MEAN
PDF
A Quick Intro to ReactiveX
PDF
JavaScript Foundations Day1
Fast C++ Web Servers
Node Boot Camp
AWS Lambda Function with Kotlin
React Native One Day
React Native Evening
Intro to React
React Development with the MERN Stack
Angular Application Testing
ReactJS.NET
What is Angular version 4?
Angular Weekend
From MEAN to the MERN Stack
Functional Programming in JavaScript
Functional Programming in Clojure
MEAN Stack Warm-up
Game Design and Development Workshop Day 1
Build a Game in 60 minutes
Quick & Dirty & MEAN
A Quick Intro to ReactiveX
JavaScript Foundations Day1

Recently uploaded (20)

PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PPTX
ai tools demonstartion for schools and inter college
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PPTX
ISO 45001 Occupational Health and Safety Management System
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Nekopoi APK 2025 free lastest update
PPTX
Odoo POS Development Services by CandidRoot Solutions
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PPT
Introduction Database Management System for Course Database
PPTX
Introduction to Artificial Intelligence
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PPTX
Online Work Permit System for Fast Permit Processing
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Operating system designcfffgfgggggggvggggggggg
VVF-Customer-Presentation2025-Ver1.9.pptx
Design an Analysis of Algorithms I-SECS-1021-03
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
ai tools demonstartion for schools and inter college
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Softaken Excel to vCard Converter Software.pdf
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
ISO 45001 Occupational Health and Safety Management System
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Odoo Companies in India – Driving Business Transformation.pdf
Nekopoi APK 2025 free lastest update
Odoo POS Development Services by CandidRoot Solutions
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
Introduction Database Management System for Course Database
Introduction to Artificial Intelligence
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
Online Work Permit System for Fast Permit Processing

The JavaScript You Wished You Knew