SlideShare a Scribd company logo
{

Functional programming in JavaScript
… and the curious case of _.js

Om Shankar
JavaScripter @ InMobi

bit.ly/omshankar
Functional programming is the use of functions that
transform values into units of abstraction, subsequently
used to build software systems.
Do Something !
– by doing this, and then that,
– and don’t forget to do this at the end of all that.

Get Something Done !
– I don’t care how you do it,
– also, when I want it done again, it should be as easy as it was the first
time.

Declarative programming: stackoverflow.com/a/8357604/1249219
Closures

Flow and Chaining

Recursion

{

Functions constructing Functions

The building blocks of Functional JavaScript

Mutation policies
Functions passed as parameters
Class-less JavaScript
• Should travel in First Class
• Should be Pure, hence, should be re-usable
• Should be Applicative
- function A supplied to B should perform actions in B’s context.
Strings are first class in JS,
- so are functions with all possible operations
// Both can be stored
var string = "BangaloreJS";
var stringFn = function() { return "BangaloreJS"; }
// can be used on the fly, as an expression:
// string
"BangaloreJS";
"BangaloreJS".slice(3);
// function
"BangaloreJS" + (function(){ return " Rocks !!"; }());
A pure function
•
•
•
•

takes argument(s)
returns value(s)
returns same value(s) for same argument(s)
does nothing else !

Arguments

Return value
An impure function
• takes argument(s)
• returns value(s)
• reads/writes external states, for
eg., modifies global DOM, objects, arrays.
Read State
Arguments

Return value
tightly coupled with read state

Change State
_. map
reduce / reduceRight
find / detect / where
filter / reject
every / some
...
_.bind(scopeObject, normalFn);
_.bindAll(obj, fn1, [fn2, fn3, ...]);

• Creating a complement function
• Creating a repeater function
Functions taking functions as parameters

function repeat(times, fn) {
return _.map(_.range(times), fn);
}
Functions returning functions as value
var numData = [1,2,null,4,5];
_.reduce(numData, function(tot, curr) {
return tot * curr;
});
// Problem?
// Solution: function returning modified safe function
// and not imperatively modified data
// though what we actually do is modify data on the fly
RxJS
- Reactive extensions for JS by Microsoft

{

Declarative JavaScript Libraries

Bilby.js - bilby.brianmckenna.org
Allong.es - github.com/fogus/lemonad
CoffeScript - coffeescript.org

{

Declarative JavaScript Compilers

ClojureScript - github.com/clojure/clojurescript

ROY - bilby.brianmckenna.org
@om_invincible

{

geekyogi.com

End of Part - 1
Happy JavaScript-ing

github.com/OmShiv

bit.ly/omshankar
Ad

Recommended

JavaScript Object Oriented Programming Cheat Sheet
JavaScript Object Oriented Programming Cheat Sheet
HDR1001
 
Introduction to Object Oriented Javascript
Introduction to Object Oriented Javascript
nodeninjas
 
JavaScript: Patterns, Part 3
JavaScript: Patterns, Part 3
Chris Farrell
 
JavaScript global object, execution contexts & closures
JavaScript global object, execution contexts & closures
HDR1001
 
JavaScript: Patterns, Part 2
JavaScript: Patterns, Part 2
Chris Farrell
 
JavaScript Execution Context
JavaScript Execution Context
Juan Medina
 
Actor-based concurrency and Akka Fundamentals
Actor-based concurrency and Akka Fundamentals
Ngoc Dao
 
Oslo.versioned objects - Deep Dive
Oslo.versioned objects - Deep Dive
davanum
 
JavaScript (without DOM)
JavaScript (without DOM)
Piyush Katariya
 
Model with actors and implement with Akka
Model with actors and implement with Akka
Ngoc Dao
 
Lviv MD Day 2015 Павло Захаров "Reactive cocoa: paradigm shift"
Lviv MD Day 2015 Павло Захаров "Reactive cocoa: paradigm shift"
Lviv Startup Club
 
Functional programming and ruby in functional style
Functional programming and ruby in functional style
Niranjan Sarade
 
Qtp training session IV
Qtp training session IV
Aisha Mazhar
 
Continuations in scala (incomplete version)
Continuations in scala (incomplete version)
Fuqiang Wang
 
Groovy / comparison with java
Groovy / comparison with java
Liviu Tudor
 
libSEDML (Harmony 2012)
libSEDML (Harmony 2012)
Frank Bergmann
 
What’s new in Kotlin?
What’s new in Kotlin?
Squareboat
 
Scala the-good-parts
Scala the-good-parts
Fuqiang Wang
 
WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD?
WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD?
reactima
 
Threads
Threads
Kavita Kanojiya
 
Advanced Javascript
Advanced Javascript
Dhruvin Shah
 
oojs
oojs
Imran shaikh
 
JavaScript
JavaScript
StrasWeb
 
Thinking Functionally
Thinking Functionally
Piyush Katariya
 
10. Function I
10. Function I
Joseph Murphy
 
Davide Cerbo - Kotlin loves React - Codemotion Milan 2018
Davide Cerbo - Kotlin loves React - Codemotion Milan 2018
Codemotion
 
Async queue-transaction
Async queue-transaction
Fei (James) Liu
 
Bldr: A Minimalist JSON Templating DSL
Bldr: A Minimalist JSON Templating DSL
Alex Sharp
 
Real Estate Investment Trusts
Real Estate Investment Trusts
SapphireCapitalPartners
 
Presentation1
Presentation1
willingariel
 

More Related Content

What's hot (20)

JavaScript (without DOM)
JavaScript (without DOM)
Piyush Katariya
 
Model with actors and implement with Akka
Model with actors and implement with Akka
Ngoc Dao
 
Lviv MD Day 2015 Павло Захаров "Reactive cocoa: paradigm shift"
Lviv MD Day 2015 Павло Захаров "Reactive cocoa: paradigm shift"
Lviv Startup Club
 
Functional programming and ruby in functional style
Functional programming and ruby in functional style
Niranjan Sarade
 
Qtp training session IV
Qtp training session IV
Aisha Mazhar
 
Continuations in scala (incomplete version)
Continuations in scala (incomplete version)
Fuqiang Wang
 
Groovy / comparison with java
Groovy / comparison with java
Liviu Tudor
 
libSEDML (Harmony 2012)
libSEDML (Harmony 2012)
Frank Bergmann
 
What’s new in Kotlin?
What’s new in Kotlin?
Squareboat
 
Scala the-good-parts
Scala the-good-parts
Fuqiang Wang
 
WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD?
WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD?
reactima
 
Threads
Threads
Kavita Kanojiya
 
Advanced Javascript
Advanced Javascript
Dhruvin Shah
 
oojs
oojs
Imran shaikh
 
JavaScript
JavaScript
StrasWeb
 
Thinking Functionally
Thinking Functionally
Piyush Katariya
 
10. Function I
10. Function I
Joseph Murphy
 
Davide Cerbo - Kotlin loves React - Codemotion Milan 2018
Davide Cerbo - Kotlin loves React - Codemotion Milan 2018
Codemotion
 
Async queue-transaction
Async queue-transaction
Fei (James) Liu
 
Bldr: A Minimalist JSON Templating DSL
Bldr: A Minimalist JSON Templating DSL
Alex Sharp
 
JavaScript (without DOM)
JavaScript (without DOM)
Piyush Katariya
 
Model with actors and implement with Akka
Model with actors and implement with Akka
Ngoc Dao
 
Lviv MD Day 2015 Павло Захаров "Reactive cocoa: paradigm shift"
Lviv MD Day 2015 Павло Захаров "Reactive cocoa: paradigm shift"
Lviv Startup Club
 
Functional programming and ruby in functional style
Functional programming and ruby in functional style
Niranjan Sarade
 
Qtp training session IV
Qtp training session IV
Aisha Mazhar
 
Continuations in scala (incomplete version)
Continuations in scala (incomplete version)
Fuqiang Wang
 
Groovy / comparison with java
Groovy / comparison with java
Liviu Tudor
 
libSEDML (Harmony 2012)
libSEDML (Harmony 2012)
Frank Bergmann
 
What’s new in Kotlin?
What’s new in Kotlin?
Squareboat
 
Scala the-good-parts
Scala the-good-parts
Fuqiang Wang
 
WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD?
WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD?
reactima
 
Advanced Javascript
Advanced Javascript
Dhruvin Shah
 
JavaScript
JavaScript
StrasWeb
 
Davide Cerbo - Kotlin loves React - Codemotion Milan 2018
Davide Cerbo - Kotlin loves React - Codemotion Milan 2018
Codemotion
 
Async queue-transaction
Async queue-transaction
Fei (James) Liu
 
Bldr: A Minimalist JSON Templating DSL
Bldr: A Minimalist JSON Templating DSL
Alex Sharp
 

Viewers also liked (20)

Real Estate Investment Trusts
Real Estate Investment Trusts
SapphireCapitalPartners
 
Presentation1
Presentation1
willingariel
 
Introduction to MHA Lighting
Introduction to MHA Lighting
adele101
 
Mha Garage Catalogue
Mha Garage Catalogue
adele101
 
Mha Catalogue 2012
Mha Catalogue 2012
adele101
 
Who am i
Who am i
codyhoare
 
Pdf piel y faremas
Pdf piel y faremas
Diianiitha Perez
 
Katalog Ajija edisi 03 Juni - Juli
Katalog Ajija edisi 03 Juni - Juli
DonaIncim
 
Olympic Travel Update - Vauxhall One / TfL
Olympic Travel Update - Vauxhall One / TfL
VauxhallOne
 
Bai giang ktlt-v2010_academia.edu-libre
Bai giang ktlt-v2010_academia.edu-libre
Tony Khánh
 
Gatsby powerpoint
Gatsby powerpoint
mm232h
 
Loi santé et Transparence
Loi santé et Transparence
Market iT
 
Journée nationale innovation santé
Journée nationale innovation santé
Market iT
 
Mardi 31 mai 2016 | Statut et missions des MSL (Medical Science Liaison) : ...
Mardi 31 mai 2016 | Statut et missions des MSL (Medical Science Liaison) : ...
Market iT
 
NHS England - Managing conflicts of interest
NHS England - Managing conflicts of interest
Market iT
 
Les conflits d'intérêts au sein de l'AP-HP
Les conflits d'intérêts au sein de l'AP-HP
Market iT
 
Atemporal
Atemporal
Josue Daniel Rivera
 
Jeudi 24 mars 2016 | Savoir exploiter les congrès en évitant le risque de qu...
Jeudi 24 mars 2016 | Savoir exploiter les congrès en évitant le risque de qu...
Market iT
 
Jeudi 7 avril 2016 | Transparence et collaboration avec les personnes morales...
Jeudi 7 avril 2016 | Transparence et collaboration avec les personnes morales...
Market iT
 
Communique de Presse AFCDP - 24 mai 2016
Communique de Presse AFCDP - 24 mai 2016
Market iT
 
Introduction to MHA Lighting
Introduction to MHA Lighting
adele101
 
Mha Garage Catalogue
Mha Garage Catalogue
adele101
 
Mha Catalogue 2012
Mha Catalogue 2012
adele101
 
Katalog Ajija edisi 03 Juni - Juli
Katalog Ajija edisi 03 Juni - Juli
DonaIncim
 
Olympic Travel Update - Vauxhall One / TfL
Olympic Travel Update - Vauxhall One / TfL
VauxhallOne
 
Bai giang ktlt-v2010_academia.edu-libre
Bai giang ktlt-v2010_academia.edu-libre
Tony Khánh
 
Gatsby powerpoint
Gatsby powerpoint
mm232h
 
Loi santé et Transparence
Loi santé et Transparence
Market iT
 
Journée nationale innovation santé
Journée nationale innovation santé
Market iT
 
Mardi 31 mai 2016 | Statut et missions des MSL (Medical Science Liaison) : ...
Mardi 31 mai 2016 | Statut et missions des MSL (Medical Science Liaison) : ...
Market iT
 
NHS England - Managing conflicts of interest
NHS England - Managing conflicts of interest
Market iT
 
Les conflits d'intérêts au sein de l'AP-HP
Les conflits d'intérêts au sein de l'AP-HP
Market iT
 
Jeudi 24 mars 2016 | Savoir exploiter les congrès en évitant le risque de qu...
Jeudi 24 mars 2016 | Savoir exploiter les congrès en évitant le risque de qu...
Market iT
 
Jeudi 7 avril 2016 | Transparence et collaboration avec les personnes morales...
Jeudi 7 avril 2016 | Transparence et collaboration avec les personnes morales...
Market iT
 
Communique de Presse AFCDP - 24 mai 2016
Communique de Presse AFCDP - 24 mai 2016
Market iT
 
Ad

Similar to Declarative JavaScript concepts and implemetation (20)

JavaScript - Chapter 6 - Basic Functions
JavaScript - Chapter 6 - Basic Functions
WebStackAcademy
 
Functional programming in clojure
Functional programming in clojure
Juan-Manuel Gimeno
 
Awesomeness of JavaScript…almost
Awesomeness of JavaScript…almost
Quinton Sheppard
 
[2015/2016] JavaScript
[2015/2016] JavaScript
Ivano Malavolta
 
JavaScript for real men
JavaScript for real men
Ivano Malavolta
 
JS Essence
JS Essence
Uladzimir Piatryka
 
Functional programming in javascript
Functional programming in javascript
Boris Burdiliak
 
Intro to JavaScript - Week 2: Function
Intro to JavaScript - Week 2: Function
Jeongbae Oh
 
JavaScript - Chapter 7 - Advanced Functions
JavaScript - Chapter 7 - Advanced Functions
WebStackAcademy
 
(3) cpp procedural programming
(3) cpp procedural programming
Nico Ludwig
 
Thinking Functionally - John Stevenson - Codemotion Rome 2017
Thinking Functionally - John Stevenson - Codemotion Rome 2017
Codemotion
 
Thinking Functionally with Clojure
Thinking Functionally with Clojure
John Stevenson
 
Lecture 4- Javascript Function presentation
Lecture 4- Javascript Function presentation
GomathiUdai
 
JavaScript
JavaScript
Ivano Malavolta
 
Java Script Promise
Java Script Promise
Alok Guha
 
JavaScript For CSharp Developer
JavaScript For CSharp Developer
Sarvesh Kushwaha
 
ES6 metaprogramming unleashed
ES6 metaprogramming unleashed
Javier Arias Losada
 
Sql functions
Sql functions
Ankit Dubey
 
predefined and user defined functions
predefined and user defined functions
Swapnil Yadav
 
Douglas Crockford: Serversideness
Douglas Crockford: Serversideness
WebExpo
 
JavaScript - Chapter 6 - Basic Functions
JavaScript - Chapter 6 - Basic Functions
WebStackAcademy
 
Functional programming in clojure
Functional programming in clojure
Juan-Manuel Gimeno
 
Awesomeness of JavaScript…almost
Awesomeness of JavaScript…almost
Quinton Sheppard
 
Functional programming in javascript
Functional programming in javascript
Boris Burdiliak
 
Intro to JavaScript - Week 2: Function
Intro to JavaScript - Week 2: Function
Jeongbae Oh
 
JavaScript - Chapter 7 - Advanced Functions
JavaScript - Chapter 7 - Advanced Functions
WebStackAcademy
 
(3) cpp procedural programming
(3) cpp procedural programming
Nico Ludwig
 
Thinking Functionally - John Stevenson - Codemotion Rome 2017
Thinking Functionally - John Stevenson - Codemotion Rome 2017
Codemotion
 
Thinking Functionally with Clojure
Thinking Functionally with Clojure
John Stevenson
 
Lecture 4- Javascript Function presentation
Lecture 4- Javascript Function presentation
GomathiUdai
 
Java Script Promise
Java Script Promise
Alok Guha
 
JavaScript For CSharp Developer
JavaScript For CSharp Developer
Sarvesh Kushwaha
 
predefined and user defined functions
predefined and user defined functions
Swapnil Yadav
 
Douglas Crockford: Serversideness
Douglas Crockford: Serversideness
WebExpo
 
Ad

Recently uploaded (20)

"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
Fwdays
 
" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
Fwdays
 
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Priyanka Aash
 
From Manual to Auto Searching- FME in the Driver's Seat
From Manual to Auto Searching- FME in the Driver's Seat
Safe Software
 
AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
 
Lessons Learned from Developing Secure AI Workflows.pdf
Lessons Learned from Developing Secure AI Workflows.pdf
Priyanka Aash
 
Daily Lesson Log MATATAG ICT TEchnology 8
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
Agentic AI for Developers and Data Scientists Build an AI Agent in 10 Lines o...
Agentic AI for Developers and Data Scientists Build an AI Agent in 10 Lines o...
All Things Open
 
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
yosra Saidani
 
Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Josef Weingand
 
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
caoyixuan2019
 
The Growing Value and Application of FME & GenAI
The Growing Value and Application of FME & GenAI
Safe Software
 
Connecting Data and Intelligence: The Role of FME in Machine Learning
Connecting Data and Intelligence: The Role of FME in Machine Learning
Safe Software
 
Database Benchmarking for Performance Masterclass: Session 2 - Data Modeling ...
Database Benchmarking for Performance Masterclass: Session 2 - Data Modeling ...
ScyllaDB
 
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
revolcs10
 
"Database isolation: how we deal with hundreds of direct connections to the d...
"Database isolation: how we deal with hundreds of direct connections to the d...
Fwdays
 
PyCon SG 25 - Firecracker Made Easy with Python.pdf
PyCon SG 25 - Firecracker Made Easy with Python.pdf
Muhammad Yuga Nugraha
 
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
Earley Information Science
 
Securing Account Lifecycles in the Age of Deepfakes.pptx
Securing Account Lifecycles in the Age of Deepfakes.pptx
FIDO Alliance
 
10 Key Challenges for AI within the EU Data Protection Framework.pdf
10 Key Challenges for AI within the EU Data Protection Framework.pdf
Priyanka Aash
 
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
Fwdays
 
" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
Fwdays
 
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Priyanka Aash
 
From Manual to Auto Searching- FME in the Driver's Seat
From Manual to Auto Searching- FME in the Driver's Seat
Safe Software
 
AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
 
Lessons Learned from Developing Secure AI Workflows.pdf
Lessons Learned from Developing Secure AI Workflows.pdf
Priyanka Aash
 
Daily Lesson Log MATATAG ICT TEchnology 8
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
Agentic AI for Developers and Data Scientists Build an AI Agent in 10 Lines o...
Agentic AI for Developers and Data Scientists Build an AI Agent in 10 Lines o...
All Things Open
 
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
yosra Saidani
 
Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Josef Weingand
 
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
caoyixuan2019
 
The Growing Value and Application of FME & GenAI
The Growing Value and Application of FME & GenAI
Safe Software
 
Connecting Data and Intelligence: The Role of FME in Machine Learning
Connecting Data and Intelligence: The Role of FME in Machine Learning
Safe Software
 
Database Benchmarking for Performance Masterclass: Session 2 - Data Modeling ...
Database Benchmarking for Performance Masterclass: Session 2 - Data Modeling ...
ScyllaDB
 
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
revolcs10
 
"Database isolation: how we deal with hundreds of direct connections to the d...
"Database isolation: how we deal with hundreds of direct connections to the d...
Fwdays
 
PyCon SG 25 - Firecracker Made Easy with Python.pdf
PyCon SG 25 - Firecracker Made Easy with Python.pdf
Muhammad Yuga Nugraha
 
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
Earley Information Science
 
Securing Account Lifecycles in the Age of Deepfakes.pptx
Securing Account Lifecycles in the Age of Deepfakes.pptx
FIDO Alliance
 
10 Key Challenges for AI within the EU Data Protection Framework.pdf
10 Key Challenges for AI within the EU Data Protection Framework.pdf
Priyanka Aash
 

Declarative JavaScript concepts and implemetation

  • 1. { Functional programming in JavaScript … and the curious case of _.js Om Shankar JavaScripter @ InMobi bit.ly/omshankar
  • 2. Functional programming is the use of functions that transform values into units of abstraction, subsequently used to build software systems.
  • 3. Do Something ! – by doing this, and then that, – and don’t forget to do this at the end of all that. Get Something Done ! – I don’t care how you do it, – also, when I want it done again, it should be as easy as it was the first time. Declarative programming: stackoverflow.com/a/8357604/1249219
  • 4. Closures Flow and Chaining Recursion { Functions constructing Functions The building blocks of Functional JavaScript Mutation policies Functions passed as parameters Class-less JavaScript
  • 5. • Should travel in First Class • Should be Pure, hence, should be re-usable • Should be Applicative - function A supplied to B should perform actions in B’s context.
  • 6. Strings are first class in JS, - so are functions with all possible operations // Both can be stored var string = "BangaloreJS"; var stringFn = function() { return "BangaloreJS"; } // can be used on the fly, as an expression: // string "BangaloreJS"; "BangaloreJS".slice(3); // function "BangaloreJS" + (function(){ return " Rocks !!"; }());
  • 7. A pure function • • • • takes argument(s) returns value(s) returns same value(s) for same argument(s) does nothing else ! Arguments Return value
  • 8. An impure function • takes argument(s) • returns value(s) • reads/writes external states, for eg., modifies global DOM, objects, arrays. Read State Arguments Return value tightly coupled with read state Change State
  • 9. _. map reduce / reduceRight find / detect / where filter / reject every / some ...
  • 10. _.bind(scopeObject, normalFn); _.bindAll(obj, fn1, [fn2, fn3, ...]); • Creating a complement function • Creating a repeater function
  • 11. Functions taking functions as parameters function repeat(times, fn) { return _.map(_.range(times), fn); }
  • 12. Functions returning functions as value var numData = [1,2,null,4,5]; _.reduce(numData, function(tot, curr) { return tot * curr; }); // Problem? // Solution: function returning modified safe function // and not imperatively modified data // though what we actually do is modify data on the fly
  • 13. RxJS - Reactive extensions for JS by Microsoft { Declarative JavaScript Libraries Bilby.js - bilby.brianmckenna.org Allong.es - github.com/fogus/lemonad
  • 14. CoffeScript - coffeescript.org { Declarative JavaScript Compilers ClojureScript - github.com/clojure/clojurescript ROY - bilby.brianmckenna.org
  • 15. @om_invincible { geekyogi.com End of Part - 1 Happy JavaScript-ing github.com/OmShiv bit.ly/omshankar