An Introduction to Higher-Order Functions in JavaScript

  Рет қаралды 4,506

Zaiste Programming

Zaiste Programming

Күн бұрын

Higher Order Functions are functions that can be passed as input to other functions
or functions that can be returned from other functions as output. It is enough for a function to fulfill one of these conditions to be considered a higher-order function.
Higher-Order Functions allow to create convenient abstractions so that it is easier to reason about programs and their structure. In JavaScript there are many higher-order functions built in, one of them is the sort functions defined as a method on the Array object.
Functional programming is a programming paradigm in which you build programs by composing functions. The computation is then the evaluation of those functions. Functional programming focuses on the usage of pure functions and on avoiding shared, mutable state. This programming paradigm is declarative. Functional code is usually more concise and easier to test.
In this mini series, we will embark on an exciting journey to learn a bit about functional programming by using JavaScript. Presented concepts will be mostly universal and applicable to other programming languages. This series is created with beginners and non-programmers in mind; don't worry, we will take it slowly!
Zaiste Weekly Newsletter: bit.ly/zaiste-weekly
#functional #javascript #memoization

Пікірлер: 12
@danieldesouzaramos
@danieldesouzaramos 3 жыл бұрын
came for the javascript, stayed for the calming keyboard sounds
@RobertWildling
@RobertWildling 5 жыл бұрын
You continue to amaze me, how well you can explain! Thank you so much for this learning experience! It feels like clouds were blown away and the sun shines as clear as never before!
@seven6586
@seven6586 3 жыл бұрын
I think I finally understand the mechanism of creating functions with two pairs of brackets and two fat arrows 🤯🧠!! So awesome ❤️ So happy!! Impossible is nothing 😅 thanks a million Zaiste Sir!!! Juhuuu!! :D
@masquereseau5635
@masquereseau5635 4 жыл бұрын
You could even pass console.log as a value for a defaultOutput argument for the profile function.
@LanguageSkillz
@LanguageSkillz 3 жыл бұрын
Where do objects as collections, for working data conserved in a JS application, factor into a functional programming paradigm? Are those return values, in the associated functions, what looks to get handled with referential transparency? Foregoing the conventional object literal constructs altogether? How so less susceptible to security breach?
@magno5157
@magno5157 5 жыл бұрын
I think it's stupid to use "const variable = (shit1, shit2) => something;" if the arrow function has at least 2 lines. We already have a special syntax for function that cannot already be redefined by default! Binding an arrow function to a const variable makes it messier and less readable. When people see the keyword "const" in an assignment, what follows can either be non-function expression or it can be a function expression/arrow function. However, when we use the keyword "function", it's immediately obvious what follows.
@DarrylHebbes
@DarrylHebbes 4 жыл бұрын
How something looks is not equivalent to how it functions
@LanguageSkillz
@LanguageSkillz 3 жыл бұрын
But it also tells you that it's not subject to mutation.
@TheNamesJT
@TheNamesJT 4 жыл бұрын
confusing and don't think i will ever understand this
@LanguageSkillz
@LanguageSkillz 3 жыл бұрын
I have just gotten to more intently comparing factory functions with class constructors, as well as considering scenarios not at all well suited to arrow functions, and I think the sort of example he gives above is incredibly strong in its simplicity. It makes a good case for ever considering how to add to a computer program: accuracy or precision with steps of operations that can cover conditional designations and/or functionalities, without the hugest of constructs. The efficiency standpoint has gotten on some nerves as a latest optimization buzzword, but in terms of storage demands and very much in terms of deciphering code in order to actively maintain and keep cleaner and simpler to run, it's nice to see neat alternatives to nested loops and arrays.
@LanguageSkillz
@LanguageSkillz 3 жыл бұрын
kzbin.info/www/bejne/m16YoJWjZqySfLs I encountered Zaiste's predicate functions segment (#6 of his series) before watching the 20 minute presentation I pasted at the start of this comment. The presenter gives some ready examples about how and why a functions-of-functions paradigm looks to inform more code behaviors, with routine prototype methods that can be applied to achieve changes without mutating values and thereby compromising soundness of code. Also, the node references are important for functions involving larger amounts of data, where new arrays would get too heavy each time. It helps to pickup and leave off at points of the data, rather than mutating any segments of data which can have other dependencies, or carrying the full load of copies.
@samoh6084
@samoh6084 3 жыл бұрын
U totally kind of copied and pasted Eloquent Jacascript
Functional JavaScript Tutorial #6 - What are predicates?
7:08
Zaiste Programming
Рет қаралды 3,7 М.
КАК ДУМАЕТЕ КТО ВЫЙГРАЕТ😂
00:29
МЯТНАЯ ФАНТА
Рет қаралды 10 МЛН
Пранк пошел не по плану…🥲
00:59
Саша Квашеная
Рет қаралды 6 МЛН
Doing This Instead Of Studying.. 😳
00:12
Jojo Sim
Рет қаралды 8 МЛН
3 Easy Ways To Read More
4:04
Pronoia
Рет қаралды 255
Water powered timers hidden in public restrooms
13:12
Steve Mould
Рет қаралды 734 М.
16.5: Higher Order Functions in JavaScript - Topics of JavaScript/ES6
16:21
Rust Data Modelling Without Classes
11:25
No Boilerplate
Рет қаралды 167 М.
Functional programming - A general introduction
11:47
Daedalus Community
Рет қаралды 93 М.
Pydantic Tutorial • Solving Python's Biggest Problem
11:07
pixegami
Рет қаралды 255 М.
Tag him😳💕 #miniphone #iphone #samsung #smartphone #fy
0:11
Pockify™
Рет қаралды 3,4 МЛН
Опасность фирменной зарядки Apple
0:57
SuperCrastan
Рет қаралды 11 МЛН