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

What's hot

Apollo Server III
Apollo Server IIIApollo Server III
Apollo Server III
NodeXperts
 
RxJava@Android
RxJava@AndroidRxJava@Android
RxJava@Android
Maxim Volgin
 
簡単にレビュー環境が作れる仕組みを作ってる話し
簡単にレビュー環境が作れる仕組みを作ってる話し簡単にレビュー環境が作れる仕組みを作ってる話し
簡単にレビュー環境が作れる仕組みを作ってる話し
正貴 小川
 
Lambdas HOL
Lambdas HOLLambdas HOL
Lambdas HOL
Oleg Tsal-Tsalko
 
Stack project
Stack projectStack project
Stack project
Amr Aboelgood
 
FRP
FRPFRP
Functional programming (Let's fall back in love with Programming)
Functional programming (Let's fall back in love with Programming)Functional programming (Let's fall back in love with Programming)
Functional programming (Let's fall back in love with Programming)
Sudipta Mukherjee
 
Effective c# part1
Effective c# part1Effective c# part1
Effective c# part1
Yuriy Seniuk
 
The Mayans Lost Guide to RxJava on Android
The Mayans Lost Guide to RxJava on AndroidThe Mayans Lost Guide to RxJava on Android
The Mayans Lost Guide to RxJava on Android
Fernando Cejas
 
Module 3: Introduction to LINQ (PowerPoint Slides)
Module 3: Introduction to LINQ (PowerPoint Slides)Module 3: Introduction to LINQ (PowerPoint Slides)
Module 3: Introduction to LINQ (PowerPoint Slides)
Mohamed Saleh
 
Mca ii dfs u-3 linklist,stack,queue
Mca ii dfs u-3 linklist,stack,queueMca ii dfs u-3 linklist,stack,queue
Mca ii dfs u-3 linklist,stack,queue
Rai University
 
Linq
LinqLinq
2CPP08 - Overloading and Overriding
2CPP08 - Overloading and Overriding2CPP08 - Overloading and Overriding
2CPP08 - Overloading and Overriding
Michael Heron
 
Link quries
Link quriesLink quries
Link quries
ulfat mushtaq
 
Linq
LinqLinq
Linq
samneang
 
Lambda expression par Christophe Huntzinger
Lambda expression par Christophe HuntzingerLambda expression par Christophe Huntzinger
Lambda expression par Christophe Huntzinger
Mik_Arber
 
OCL 2.4. (... 2.5)
OCL 2.4. (... 2.5)OCL 2.4. (... 2.5)
OCL 2.4. (... 2.5)
Edward Willink
 
Stacks overview with its applications
Stacks overview with its applicationsStacks overview with its applications
Stacks overview with its applicationsSaqib Saeed
 
Introduction of basics loop and array
Introduction of basics loop and arrayIntroduction of basics loop and array
Introduction of basics loop and array
projectsinfo
 

What's hot (20)

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

Similar to The JavaScript You Wished You Knew

Introduction to es6
Introduction to es6Introduction to es6
Introduction to es6
NexThoughts Technologies
 
Introduction to Ecmascript - ES6
Introduction to Ecmascript - ES6Introduction to Ecmascript - ES6
Introduction to Ecmascript - ES6
Nilesh Jayanandana
 
React & Redux JS
React & Redux JS React & Redux JS
React & Redux JS
Hamed Farag
 
Learn java
Learn javaLearn java
Learn javaPalahuja
 
Design patterns
Design patternsDesign patterns
Design patterns
Anas Alpure
 
Why Functional Programming So Hard?
Why Functional Programming So Hard?Why Functional Programming So Hard?
Why Functional Programming So Hard?
Ilya Sidorov
 
A Brief, but Dense, Intro to Scala
A Brief, but Dense, Intro to ScalaA Brief, but Dense, Intro to Scala
A Brief, but Dense, Intro to Scala
Derek Chen-Becker
 
Functional JavaScript Fundamentals
Functional JavaScript FundamentalsFunctional JavaScript Fundamentals
Functional JavaScript Fundamentals
Srdjan Strbanovic
 
Scala tutorial
Scala tutorialScala tutorial
Scala tutorial
wafianedjma
 
WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD?
WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD? WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD?
WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD?
reactima
 
JavaScript.pptx
JavaScript.pptxJavaScript.pptx
JavaScript.pptx
Govardhan Bhavani
 
ES6 presentation
ES6 presentationES6 presentation
ES6 presentation
ritika1
 
Intro to ES6 and why should you bother !
Intro to ES6 and why should you bother !Intro to ES6 and why should you bother !
Intro to ES6 and why should you bother !
Gaurav Behere
 
js.pptx
js.pptxjs.pptx
js.pptx
SuhaibKhan62
 
Douglas Crockford Presentation Goodparts
Douglas Crockford Presentation GoodpartsDouglas Crockford Presentation Goodparts
Douglas Crockford Presentation GoodpartsAjax Experience 2009
 
Scala Days San Francisco
Scala Days San FranciscoScala Days San Francisco
Scala Days San Francisco
Martin Odersky
 
JavaScript OOPS Implimentation
JavaScript OOPS ImplimentationJavaScript OOPS Implimentation
JavaScript OOPS Implimentation
Usman Mehmood
 
Java mcq
Java mcqJava mcq
Java mcq
avinash9821
 
Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009
Martin Odersky
 

Similar to The JavaScript You Wished You Knew (20)

Introduction to es6
Introduction to es6Introduction to es6
Introduction to es6
 
Introduction to Ecmascript - ES6
Introduction to Ecmascript - ES6Introduction to Ecmascript - ES6
Introduction to Ecmascript - ES6
 
React & Redux JS
React & Redux JS React & Redux JS
React & Redux JS
 
Learn java
Learn javaLearn java
Learn java
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Why Functional Programming So Hard?
Why Functional Programming So Hard?Why Functional Programming So Hard?
Why Functional Programming So Hard?
 
A Brief, but Dense, Intro to Scala
A Brief, but Dense, Intro to ScalaA Brief, but Dense, Intro to Scala
A Brief, but Dense, Intro to Scala
 
Functional JavaScript Fundamentals
Functional JavaScript FundamentalsFunctional JavaScript Fundamentals
Functional JavaScript Fundamentals
 
Scala tutorial
Scala tutorialScala tutorial
Scala tutorial
 
Scala tutorial
Scala tutorialScala tutorial
Scala tutorial
 
WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD?
WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD? WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD?
WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD?
 
JavaScript.pptx
JavaScript.pptxJavaScript.pptx
JavaScript.pptx
 
ES6 presentation
ES6 presentationES6 presentation
ES6 presentation
 
Intro to ES6 and why should you bother !
Intro to ES6 and why should you bother !Intro to ES6 and why should you bother !
Intro to ES6 and why should you bother !
 
js.pptx
js.pptxjs.pptx
js.pptx
 
Douglas Crockford Presentation Goodparts
Douglas Crockford Presentation GoodpartsDouglas Crockford Presentation Goodparts
Douglas Crockford Presentation Goodparts
 
Scala Days San Francisco
Scala Days San FranciscoScala Days San Francisco
Scala Days San Francisco
 
JavaScript OOPS Implimentation
JavaScript OOPS ImplimentationJavaScript OOPS Implimentation
JavaScript OOPS Implimentation
 
Java mcq
Java mcqJava mcq
Java mcq
 
Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009
 

More from Troy Miles

Fast C++ Web Servers
Fast C++ Web ServersFast C++ Web Servers
Fast C++ Web Servers
Troy Miles
 
Node Boot Camp
Node Boot CampNode Boot Camp
Node Boot Camp
Troy Miles
 
AWS Lambda Function with Kotlin
AWS Lambda Function with KotlinAWS Lambda Function with Kotlin
AWS Lambda Function with Kotlin
Troy Miles
 
React Native One Day
React Native One DayReact Native One Day
React Native One Day
Troy Miles
 
React Native Evening
React Native EveningReact Native Evening
React Native Evening
Troy Miles
 
Intro to React
Intro to ReactIntro to React
Intro to React
Troy Miles
 
React Development with the MERN Stack
React Development with the MERN StackReact Development with the MERN Stack
React Development with the MERN Stack
Troy Miles
 
Angular Application Testing
Angular Application TestingAngular Application Testing
Angular Application Testing
Troy Miles
 
ReactJS.NET
ReactJS.NETReactJS.NET
ReactJS.NET
Troy Miles
 
What is Angular version 4?
What is Angular version 4?What is Angular version 4?
What is Angular version 4?
Troy Miles
 
Angular Weekend
Angular WeekendAngular Weekend
Angular Weekend
Troy Miles
 
From MEAN to the MERN Stack
From MEAN to the MERN StackFrom MEAN to the MERN Stack
From MEAN to the MERN Stack
Troy Miles
 
Functional Programming in JavaScript
Functional Programming in JavaScriptFunctional Programming in JavaScript
Functional Programming in JavaScript
Troy Miles
 
Functional Programming in Clojure
Functional Programming in ClojureFunctional Programming in Clojure
Functional Programming in Clojure
Troy Miles
 
MEAN Stack Warm-up
MEAN Stack Warm-upMEAN Stack Warm-up
MEAN Stack Warm-up
Troy Miles
 
Game Design and Development Workshop Day 1
Game Design and Development Workshop Day 1Game Design and Development Workshop Day 1
Game Design and Development Workshop Day 1
Troy Miles
 
Build a Game in 60 minutes
Build a Game in 60 minutesBuild a Game in 60 minutes
Build a Game in 60 minutes
Troy Miles
 
Quick & Dirty & MEAN
Quick & Dirty & MEANQuick & Dirty & MEAN
Quick & Dirty & MEAN
Troy Miles
 
A Quick Intro to ReactiveX
A Quick Intro to ReactiveXA Quick Intro to ReactiveX
A Quick Intro to ReactiveX
Troy Miles
 
JavaScript Foundations Day1
JavaScript Foundations Day1JavaScript Foundations Day1
JavaScript Foundations Day1
Troy Miles
 

More from Troy Miles (20)

Fast C++ Web Servers
Fast C++ Web ServersFast C++ Web Servers
Fast C++ Web Servers
 
Node Boot Camp
Node Boot CampNode Boot Camp
Node Boot Camp
 
AWS Lambda Function with Kotlin
AWS Lambda Function with KotlinAWS Lambda Function with Kotlin
AWS Lambda Function with Kotlin
 
React Native One Day
React Native One DayReact Native One Day
React Native One Day
 
React Native Evening
React Native EveningReact Native Evening
React Native Evening
 
Intro to React
Intro to ReactIntro to React
Intro to React
 
React Development with the MERN Stack
React Development with the MERN StackReact Development with the MERN Stack
React Development with the MERN Stack
 
Angular Application Testing
Angular Application TestingAngular Application Testing
Angular Application Testing
 
ReactJS.NET
ReactJS.NETReactJS.NET
ReactJS.NET
 
What is Angular version 4?
What is Angular version 4?What is Angular version 4?
What is Angular version 4?
 
Angular Weekend
Angular WeekendAngular Weekend
Angular Weekend
 
From MEAN to the MERN Stack
From MEAN to the MERN StackFrom MEAN to the MERN Stack
From MEAN to the MERN Stack
 
Functional Programming in JavaScript
Functional Programming in JavaScriptFunctional Programming in JavaScript
Functional Programming in JavaScript
 
Functional Programming in Clojure
Functional Programming in ClojureFunctional Programming in Clojure
Functional Programming in Clojure
 
MEAN Stack Warm-up
MEAN Stack Warm-upMEAN Stack Warm-up
MEAN Stack Warm-up
 
Game Design and Development Workshop Day 1
Game Design and Development Workshop Day 1Game Design and Development Workshop Day 1
Game Design and Development Workshop Day 1
 
Build a Game in 60 minutes
Build a Game in 60 minutesBuild a Game in 60 minutes
Build a Game in 60 minutes
 
Quick & Dirty & MEAN
Quick & Dirty & MEANQuick & Dirty & MEAN
Quick & Dirty & MEAN
 
A Quick Intro to ReactiveX
A Quick Intro to ReactiveXA Quick Intro to ReactiveX
A Quick Intro to ReactiveX
 
JavaScript Foundations Day1
JavaScript Foundations Day1JavaScript Foundations Day1
JavaScript Foundations Day1
 

Recently uploaded

Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
e20449
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
Tier1 app
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 

Recently uploaded (20)

Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 

The JavaScript You Wished You Knew

  • 1. PeopleSpace 23 August 2016 The JavaScript You Wished You Knew
  • 2. Troy Miles Troy Miles Speaker and author https:// therockncoder.com/ rockncoder@gmail.com @therockncoder
  • 4. 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/
  • 6. 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
  • 7. 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
  • 8. (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
  • 9. Bad math JavaScript doesn’t have multiple kinds of numbers This means we are vulnerable to some shortcomings of base-2 numbers
  • 10. 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)
  • 12. 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
  • 13. 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
  • 14. 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
  • 15. 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
  • 16. 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
  • 17. 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
  • 18. 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
  • 19. ES3
  • 20. 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
  • 21. 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
  • 22. ES5
  • 23. 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
  • 24. 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
  • 25. 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
  • 27. 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
  • 28. 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