SlideShare a Scribd company logo
1
Functional Programming
in JavaScript & ESNext
Navin Singh, ThoughtWorks, @official_naveen
Ram Shinde, ThoughtWorks, @ramshinde92
Flock (Group of Birds)
Conjoin = Add ( + )
A B C
( x ) Breed = Multiply
A Function
● Takes a value
● Results through a return value
SAME
A Pure Function
● Takes a value, and operates only
on that value
● Given the same Input, always
gives the same Output
-------------------------------------------------------
No side effects
Domain to Range (Pure Functions)
Side Effects
- Anything occurring in our function body other than the computation of a
result.
- Observable interaction with the outside world
- List may include
- Making an API call
- Querying/Updating the DOM
- Mutations
- Interaction with FS
Functional Programming
History Definition
History
● Modelling computation
● Express computation in terms of units of expression
● A lambda Expression defines
○ Function parameters
○ Body
● Lambda Calculus by Alonzo Church
Definition
A Paradigm where computation is performed through expressions, avoiding
mutations.
The real enemy… is unexpected dependency and mutation of state, which
functional programming solves more directly and completely.
- John Carmack
Some tools
● Higher Order Functions
● Curry
● Compose
● Functors
Declarative - Do not iterate
It’s like writing expression, as opposed to step by step instructions.
It specifies what, and not how.
Higher Order Function
A Higher Order Function is a function that accepts a function as one of its
parameters and/or returns a function.
Map, Filter & Reduce are widely used.
Higher Order Function - Example
Tools - Currying
Composition
Composition - Example
Type Signatures
Type Signatures
What are they ?
They are meta language helping to understand the expression more effectively.
Why do we need them ?
Can be thought as type annotations in functional programming.
For Eg:- Typescript, Flow
System Used to define: Hindley Milner
Functors
Functors (Maybe)
Advantages of Pure Functions
● Cacheable
● Lazy Evaluation
● Referential Transparency
● Testable
● Parallel
Languages that encourage/support Functional
Programming
● Haskell
● Elm
● Erlang
● F#
● Clojure
● Scala
● OCaml
● JavaScript
Functional JavaScript Libraries
● Ramda
● Lodash/fp
● Immutable.js
● Mori.js
● RxJS
● Functional.js
● FolkTale.js
References
Mostly Adequate Guide to Functional Programming - Dr. Frisby
Functional Programming Basics in ES6 - Coding Tech
Functional Programming Series - FunFunFunction
Learning Functional Programming - Anjana Vakil
What is a functor?
Awesome FP JS
ESNext
1. What is ESNext?
2. Who designs ECMAScript?
3. How is it designed?
0 Strawman
1 Proposal
2 Draft
3 Candidate
4 Finished
What is ESNext
ESNext, simply put is the future version of ECMAScript, its nothing more that
one the weird naming conventions JS is famous for.
Who designs ECMAScript
European Computer Manufacturers Association (ECMA) is standards
organisation based in Geneva responsible for developing various standards in
this case ECMAScript code named ECMA-262.
How it's designed?
Stage 0: Strawman
- A free form way of submitting ideas, either from TC39 member or non-
member.
Stage 1: Proposal
- Make the case for the addition
- Describe the shape of a solution
- Prose outlining the problem or need and the general shape of a solution
Draft, Candidate & Finished
Stage 2: Draft
- 1st Version. Inclusion is likely.
- Requirement: Complete description is needed here.
Stage 3: Candidate
- Proposal is almost finished, waiting for feedback.
- Requirement: Spec must be complete
Stage 4: Finished
- Proposal is ready
- Requirement: TEST 262 acceptance
How to use ESNext
Use Babel with various presets:
● babel-preset-es2015, 2016, 2017 for specific versions
● "env" for including all the above versions
● ES2018 the only feature in pipeline which is actually called Pipeline is
under proposal and has its own Babel preset called @babel/plugin-proposal-
pipeline-operator
ECMAScript 2015
● Scoping: let and const
● Arrow Functions
● Parameter handling: default
params, rest params
● String interpolation
● Module import and export
● Class definitions
● Class inheritance
● Array.find()
● Spread operator
ECMAScript 2016
● Array.prototype.includes
ECMAScript 2016
● Exponentiation operator
ECMAScript 2017
ECMAScript 2017
Object.entries & values
ECMAScript 2018
Rest/Spread operator
Async Iteration
Pipeline Operator
References
TC39 Proposals : https://github.com/tc39
ECMAScript : https://en.wikipedia.org/wiki/ECMAScript
ECMA International : https://en.wikipedia.org/wiki/Ecma_International
Pipeline Operator : https://github.com/tc39/proposal-pipeline-operator
Babel : https://babeljs.io/
ESNext : https://github.com/esnext/esnext
THANK YOU
Ram Shinde
UI Developer, ThoughtWorks
ramks@thoughtworks.com
Navin Singh
UI Developer, ThoughtWorks
navinks@thoughtwoks.com
@ramshinde92 @official_naveen

More Related Content

PDF
Functional Programming in Ruby
Alex Teut
 
PDF
FregeDay: Design and Implementation of the language (Ingo Wechsung)
Dierk König
 
PDF
New c sharp3_features_(linq)_part_iv
Nico Ludwig
 
PDF
FregeDay: Roadmap for resolving differences between Haskell and Frege (Ingo W...
Dierk König
 
PPTX
C-Sharp 6.0 ver2
Tome Tomovski
 
KEY
Remix Your Language Tooling (JSConf.eu 2012)
lennartkats
 
PPTX
Introduction to functional programming, with Elixir
kirandanduprolu
 
PPTX
Programming in python w6
Priya Nayak
 
Functional Programming in Ruby
Alex Teut
 
FregeDay: Design and Implementation of the language (Ingo Wechsung)
Dierk König
 
New c sharp3_features_(linq)_part_iv
Nico Ludwig
 
FregeDay: Roadmap for resolving differences between Haskell and Frege (Ingo W...
Dierk König
 
C-Sharp 6.0 ver2
Tome Tomovski
 
Remix Your Language Tooling (JSConf.eu 2012)
lennartkats
 
Introduction to functional programming, with Elixir
kirandanduprolu
 
Programming in python w6
Priya Nayak
 

What's hot (20)

PPTX
Why functional programming in C# & F#
Riccardo Terrell
 
PDF
JDD 2017: Kotlin for Java developers (Tomasz Kleszczyński)
PROIDEA
 
PDF
Hanoi JUG: Java 8 & lambdas
Benoît de CHATEAUVIEUX
 
KEY
Using Aspects for Language Portability (SCAM 2010)
lennartkats
 
PDF
Functional Programming for OO Programmers (part 1)
Calvin Cheng
 
PDF
The Spoofax Language Workbench (SPLASH 2010)
lennartkats
 
PDF
Internal domain-specific languages
Mikhail Barash
 
PDF
Functional Programming in Python
Haim Michael
 
PDF
Typed Drupal - A great combination of Drupal 8 and PHP 7
Aditya Ghan
 
PPTX
PHP = PHunctional Programming
Luis Atencio
 
PPTX
C# language
Akanksha Shukla
 
PDF
C# 9 and 10 - What's cool?
Christian Nagel
 
ODP
2nd presantation
Sheay Vaishnav
 
PPTX
Learn To Code: Introduction to c
SadhanaParameswaran
 
PDF
Functional JavaScript Fundamentals
Srdjan Strbanovic
 
PPTX
WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD?
reactima
 
PPTX
The security professional's guide to programming - Eric Vanderburg
Eric Vanderburg
 
PDF
Keywords in python
PushpakBhoge
 
PDF
Implementing DSLs in practice
Mikhail Barash
 
Why functional programming in C# & F#
Riccardo Terrell
 
JDD 2017: Kotlin for Java developers (Tomasz Kleszczyński)
PROIDEA
 
Hanoi JUG: Java 8 & lambdas
Benoît de CHATEAUVIEUX
 
Using Aspects for Language Portability (SCAM 2010)
lennartkats
 
Functional Programming for OO Programmers (part 1)
Calvin Cheng
 
The Spoofax Language Workbench (SPLASH 2010)
lennartkats
 
Internal domain-specific languages
Mikhail Barash
 
Functional Programming in Python
Haim Michael
 
Typed Drupal - A great combination of Drupal 8 and PHP 7
Aditya Ghan
 
PHP = PHunctional Programming
Luis Atencio
 
C# language
Akanksha Shukla
 
C# 9 and 10 - What's cool?
Christian Nagel
 
2nd presantation
Sheay Vaishnav
 
Learn To Code: Introduction to c
SadhanaParameswaran
 
Functional JavaScript Fundamentals
Srdjan Strbanovic
 
WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD?
reactima
 
The security professional's guide to programming - Eric Vanderburg
Eric Vanderburg
 
Keywords in python
PushpakBhoge
 
Implementing DSLs in practice
Mikhail Barash
 
Ad

Similar to Functional Programming in JavaScript & ESNext (20)

PPTX
Functional programming in TypeScript
binDebug WorkSpace
 
PPTX
Introduction to Functional Programming
Dave Fancher
 
PPTX
Fuel Up JavaScript with Functional Programming
Shine Xavier
 
KEY
Exciting JavaScript - Part II
Eugene Lazutkin
 
ODP
ES6 PPT FOR 2016
Manoj Kumar
 
KEY
Scala: functional programming for the imperative mind
Sander Mak (@Sander_Mak)
 
PPTX
Things about Functional JavaScript
ChengHui Weng
 
PDF
Hands on: The sexy side of JavaScript (feat. node.js)
Francesco Pira
 
ODP
EcmaScript 6
Manoj Kumar
 
PPT
Introduction Functional Programming - Tech Hangout #11 - 2013.01.16
Innovecs
 
PPT
Introductory func prog
Oleksandr Khomenko
 
PDF
Scala qq
羽祈 張
 
PDF
What's Coming Next to JavaScript
Igalia
 
PDF
379008-rc217-functionalprogramming
Luis Atencio
 
PDF
Introduction to Functional Programming (w/ JS)
Allan Marques Baptista
 
PDF
TI1220 Lecture 6: First-class Functions
Eelco Visser
 
PDF
Functional Programming with JavaScript
Mark Shelton
 
PPTX
Basics of functional Programming by Siddharth Kulkarni
Chandulal Kavar
 
PDF
Fluent14
Brendan Eich
 
PPTX
8. Functional Programming_updated(1).pptx
jaymalachavan
 
Functional programming in TypeScript
binDebug WorkSpace
 
Introduction to Functional Programming
Dave Fancher
 
Fuel Up JavaScript with Functional Programming
Shine Xavier
 
Exciting JavaScript - Part II
Eugene Lazutkin
 
ES6 PPT FOR 2016
Manoj Kumar
 
Scala: functional programming for the imperative mind
Sander Mak (@Sander_Mak)
 
Things about Functional JavaScript
ChengHui Weng
 
Hands on: The sexy side of JavaScript (feat. node.js)
Francesco Pira
 
EcmaScript 6
Manoj Kumar
 
Introduction Functional Programming - Tech Hangout #11 - 2013.01.16
Innovecs
 
Introductory func prog
Oleksandr Khomenko
 
Scala qq
羽祈 張
 
What's Coming Next to JavaScript
Igalia
 
379008-rc217-functionalprogramming
Luis Atencio
 
Introduction to Functional Programming (w/ JS)
Allan Marques Baptista
 
TI1220 Lecture 6: First-class Functions
Eelco Visser
 
Functional Programming with JavaScript
Mark Shelton
 
Basics of functional Programming by Siddharth Kulkarni
Chandulal Kavar
 
Fluent14
Brendan Eich
 
8. Functional Programming_updated(1).pptx
jaymalachavan
 
Ad

More from Unfold UI (7)

PPTX
Normalization in Redux
Unfold UI
 
PPTX
VueJs Workshop
Unfold UI
 
PPTX
Static Type Checking with FlowJs
Unfold UI
 
PPTX
React Component in scala.js
Unfold UI
 
PDF
Forms, Components & Considerations
Unfold UI
 
PPTX
2D Page Layout
Unfold UI
 
PPTX
Progressive Web Apps
Unfold UI
 
Normalization in Redux
Unfold UI
 
VueJs Workshop
Unfold UI
 
Static Type Checking with FlowJs
Unfold UI
 
React Component in scala.js
Unfold UI
 
Forms, Components & Considerations
Unfold UI
 
2D Page Layout
Unfold UI
 
Progressive Web Apps
Unfold UI
 

Recently uploaded (20)

PPTX
Odoo Integration Services by Candidroot Solutions
CandidRoot Solutions Private Limited
 
PDF
Become an Agentblazer Champion Challenge Kickoff
Dele Amefo
 
PDF
Exploring AI Agents in Process Industries
amoreira6
 
PDF
Jenkins: An open-source automation server powering CI/CD Automation
SaikatBasu37
 
PDF
Become an Agentblazer Champion Challenge
Dele Amefo
 
PDF
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
ESUG
 
PPTX
Explanation about Structures in C language.pptx
Veeral Rathod
 
DOCX
The Future of Smart Factories Why Embedded Analytics Leads the Way
Varsha Nayak
 
PPTX
Visualising Data with Scatterplots in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PPTX
TestNG for Java Testing and Automation testing
ssuser0213cb
 
PDF
QAware_Mario-Leander_Reimer_Architecting and Building a K8s-based AI Platform...
QAware GmbH
 
PPTX
Why Use Open Source Reporting Tools for Business Intelligence.pptx
Varsha Nayak
 
PDF
Build Multi-agent using Agent Development Kit
FadyIbrahim23
 
PDF
The Role of Automation and AI in EHS Management for Data Centers.pdf
TECH EHS Solution
 
PDF
Key Features to Look for in Arizona App Development Services
Net-Craft.com
 
PDF
On Software Engineers' Productivity - Beyond Misleading Metrics
Romén Rodríguez-Gil
 
PPTX
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 
PDF
PFAS Reporting Requirements 2026 Are You Submission Ready Certivo.pdf
Certivo Inc
 
PDF
Community & News Update Q2 Meet Up 2025
VictoriaMetrics
 
PPTX
Services offered by Dynamic Solutions in Pakistan
DaniyaalAdeemShibli1
 
Odoo Integration Services by Candidroot Solutions
CandidRoot Solutions Private Limited
 
Become an Agentblazer Champion Challenge Kickoff
Dele Amefo
 
Exploring AI Agents in Process Industries
amoreira6
 
Jenkins: An open-source automation server powering CI/CD Automation
SaikatBasu37
 
Become an Agentblazer Champion Challenge
Dele Amefo
 
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
ESUG
 
Explanation about Structures in C language.pptx
Veeral Rathod
 
The Future of Smart Factories Why Embedded Analytics Leads the Way
Varsha Nayak
 
Visualising Data with Scatterplots in IBM SPSS Statistics.pptx
Version 1 Analytics
 
TestNG for Java Testing and Automation testing
ssuser0213cb
 
QAware_Mario-Leander_Reimer_Architecting and Building a K8s-based AI Platform...
QAware GmbH
 
Why Use Open Source Reporting Tools for Business Intelligence.pptx
Varsha Nayak
 
Build Multi-agent using Agent Development Kit
FadyIbrahim23
 
The Role of Automation and AI in EHS Management for Data Centers.pdf
TECH EHS Solution
 
Key Features to Look for in Arizona App Development Services
Net-Craft.com
 
On Software Engineers' Productivity - Beyond Misleading Metrics
Romén Rodríguez-Gil
 
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 
PFAS Reporting Requirements 2026 Are You Submission Ready Certivo.pdf
Certivo Inc
 
Community & News Update Q2 Meet Up 2025
VictoriaMetrics
 
Services offered by Dynamic Solutions in Pakistan
DaniyaalAdeemShibli1
 

Functional Programming in JavaScript & ESNext

  • 1. 1
  • 2. Functional Programming in JavaScript & ESNext Navin Singh, ThoughtWorks, @official_naveen Ram Shinde, ThoughtWorks, @ramshinde92
  • 3. Flock (Group of Birds) Conjoin = Add ( + ) A B C ( x ) Breed = Multiply
  • 4. A Function ● Takes a value ● Results through a return value
  • 5. SAME A Pure Function ● Takes a value, and operates only on that value ● Given the same Input, always gives the same Output ------------------------------------------------------- No side effects
  • 6. Domain to Range (Pure Functions)
  • 7. Side Effects - Anything occurring in our function body other than the computation of a result. - Observable interaction with the outside world - List may include - Making an API call - Querying/Updating the DOM - Mutations - Interaction with FS
  • 9. History ● Modelling computation ● Express computation in terms of units of expression ● A lambda Expression defines ○ Function parameters ○ Body ● Lambda Calculus by Alonzo Church
  • 10. Definition A Paradigm where computation is performed through expressions, avoiding mutations. The real enemy… is unexpected dependency and mutation of state, which functional programming solves more directly and completely. - John Carmack
  • 11. Some tools ● Higher Order Functions ● Curry ● Compose ● Functors
  • 12. Declarative - Do not iterate It’s like writing expression, as opposed to step by step instructions. It specifies what, and not how.
  • 13. Higher Order Function A Higher Order Function is a function that accepts a function as one of its parameters and/or returns a function. Map, Filter & Reduce are widely used.
  • 19. Type Signatures What are they ? They are meta language helping to understand the expression more effectively. Why do we need them ? Can be thought as type annotations in functional programming. For Eg:- Typescript, Flow System Used to define: Hindley Milner
  • 22. Advantages of Pure Functions ● Cacheable ● Lazy Evaluation ● Referential Transparency ● Testable ● Parallel
  • 23. Languages that encourage/support Functional Programming ● Haskell ● Elm ● Erlang ● F# ● Clojure ● Scala ● OCaml ● JavaScript
  • 24. Functional JavaScript Libraries ● Ramda ● Lodash/fp ● Immutable.js ● Mori.js ● RxJS ● Functional.js ● FolkTale.js
  • 25. References Mostly Adequate Guide to Functional Programming - Dr. Frisby Functional Programming Basics in ES6 - Coding Tech Functional Programming Series - FunFunFunction Learning Functional Programming - Anjana Vakil What is a functor? Awesome FP JS
  • 26. ESNext 1. What is ESNext? 2. Who designs ECMAScript? 3. How is it designed? 0 Strawman 1 Proposal 2 Draft 3 Candidate 4 Finished
  • 27. What is ESNext ESNext, simply put is the future version of ECMAScript, its nothing more that one the weird naming conventions JS is famous for. Who designs ECMAScript European Computer Manufacturers Association (ECMA) is standards organisation based in Geneva responsible for developing various standards in this case ECMAScript code named ECMA-262.
  • 28. How it's designed? Stage 0: Strawman - A free form way of submitting ideas, either from TC39 member or non- member. Stage 1: Proposal - Make the case for the addition - Describe the shape of a solution - Prose outlining the problem or need and the general shape of a solution
  • 29. Draft, Candidate & Finished Stage 2: Draft - 1st Version. Inclusion is likely. - Requirement: Complete description is needed here. Stage 3: Candidate - Proposal is almost finished, waiting for feedback. - Requirement: Spec must be complete Stage 4: Finished - Proposal is ready - Requirement: TEST 262 acceptance
  • 30. How to use ESNext Use Babel with various presets: ● babel-preset-es2015, 2016, 2017 for specific versions ● "env" for including all the above versions ● ES2018 the only feature in pipeline which is actually called Pipeline is under proposal and has its own Babel preset called @babel/plugin-proposal- pipeline-operator
  • 31. ECMAScript 2015 ● Scoping: let and const ● Arrow Functions ● Parameter handling: default params, rest params ● String interpolation ● Module import and export ● Class definitions ● Class inheritance ● Array.find() ● Spread operator
  • 38. References TC39 Proposals : https://github.com/tc39 ECMAScript : https://en.wikipedia.org/wiki/ECMAScript ECMA International : https://en.wikipedia.org/wiki/Ecma_International Pipeline Operator : https://github.com/tc39/proposal-pipeline-operator Babel : https://babeljs.io/ ESNext : https://github.com/esnext/esnext
  • 39. THANK YOU Ram Shinde UI Developer, ThoughtWorks [email protected] Navin Singh UI Developer, ThoughtWorks [email protected] @ramshinde92 @official_naveen

Editor's Notes

  • #13: Add some more pointers
  • #19: Talk about why this comment in code is valid.
  • #27: Add slide for What is ESNext and Who designs ECMAScript Who designs it => TC39 How is it designed => 5 stages ES6 with house full of features was a problem So TC39 came with 5 stages solution thereby releasing features frequently
  • #28: Add slide for What is ESNext and Who designs ECMAScript Who designs it => TC39 How is it designed => 5 stages ES6 with house full of features was a problem So TC39 came with 5 stages solution thereby releasing features frequently
  • #29: Stage 1: Champion must be identified who is responsible for proposal, Champion or co-champion must be member of TC39
  • #30: Stage 4: ECMAScript spec editor must sign off All these stages are not confirmations, they are just probables Confirmation is after they clear spec editor
  • #31: Stage 4: ECMAScript spec editor must sign off All these stages are not confirmations, they are just probables Confirmation is after they clear spec editor