JavaScript Pure Functions - Tutorial for beginners
Вставка
- Опубліковано 27 чер 2024
- Pure Functions are an essential ingredient of functional programming, regardless of the language. In this video we cover the two major rules that make any function pure, benefits of pure function, as well as why some functions can't be pure. Let's have some fun yo!
This is episode 16 of 20 things Javascript Developers Should Know But Probably Don't.
00:00:00 Intro
00:01:15 What is a pure function?
00:01:52 Rule #1: Same input means same output
00:02:58 🔴 Live coding: Rule #1
00:08:37 Benefits of Rule #1
00:10:04 Testability
00:12:05 Rule #2: No side-effects
00:12:22 🔴 Live coding: Rule #2
00:15:07 Benefits of Rule #2
00:16:40 Impure functions 😱
00:18:17 Outro
ColorCode Etsy Merchandise store:
www.etsy.com/shop/ColorCodeStore
Full playlist here: • 20 Things JavaScript D...
JavaScript Promises from the series "20 Things JS Developers Should Know but Probably Don't"
by ColorCode.io, Sina Jazayeri
** Announcement **
Full JavaScript Mastery course is coming! Sign up for Early Access here:
www.colorcode.io/js-mastery - Наука та технологія
Episode 16: Pure Functions 🤘👨💻🔥🎉
Well done .. Craig!, Can you post more often ? :D Maybe some React stuff ?
The song: counting bodies like sheep to the rhythm of the wardrums
Performed by: a perfect circle
I love your music references. 👍
Correct! Nice job
Javascript legend 🎉👍
Honey, wake up. ColorCode posted a new JavaScript video.
haha ♥
Oh man, we need a video editing tutorial as well 😛🤩
...when you find out your nascent skillset/hobby comes with a UA-camr that makes incredible content with clarity, humor, style, and beauty. And you just wish you could make him understand how much you appreciate him...
Thank you, Sina. You're like that indie film that is so special that you want everyone to see it and love it as much as you do. You're my developer-resource version of 'Sing Street' (2016). Or maybe 'You Can Count On Me' (2000).
[digital gratitude hug]
Thank you for the love, Johnny! Made my day. Great comment.
Bro thanks... The way you break down the entire language is awesome.
Sina I LOVE your way of teaching, it's just so simple, entertaining and helpful
Thank you!
You know you have the perfect combo. The videos are both interesting and useful.
I appreciate that!
Intro and editing was on the next level 💥💥💥💥
Appreciate it!
Best conceptual coding videos ❤
🕺🏻
Hats off to you, nice to have you back.
♥
Alright, im ready for the next video, keep em coming!
Soon
Welcome back with long waiting videos. Please continue. 😀
Will do!
We need consistent videos from Sin Jazzz 🎉
This video should be a preparatory course for React beginners 😏
I agree
Brief, simple, clear and fun.
Thanks for this amazing learning material
🤘🏼👍🏼
So happy to found your channel, it makes my frontend developer study journey so much better! Cheers
Cheers!
My favourite online coding teacher is back
♥🙏
Love your style of video editing and how you present the concepts in such a fun way! You deserve much much more subscribers!
Thank you!
i been browsing advanced Js tutorials all around, i got few but sounds boring, i really appreciate the energy you got while explain things, totally love it, can't wait for more content.
I appreciate that!
Best. Intro. Ever. ❤
🎉
Thank you sinaaaa ❤
♥🙏
Best content for understanding difficullt javascript concepts! Thankyou
Your edits are awesome
Ty!
Thank you so much! This is pure and simple to understand! Nice haircut! SO SO SO Looking forward to the next episode!!! Thank you again!!!!
Thank you! Coming soon
I am in Love with your explanations Bro. It's Amazing.
Tysm!
Welcomeee baaack🔥🔥🔥🔥
🙏🏼
man you are the best at acting and explaining complex stuff for me, i really enjoy your videos
Glad you like them!
You’ve explained pure functions in a way that I finally understand! 🎉 Thank you! 🙏🏼
Loving this whole series ❤ I found it searching for the Fetch API and have been back to watch the whole series 👌🏻
Awesome. Thanks!
great video as always. i think that you should address that functional programming is often about higher order functions and state separation
Nice one! ❤
Love you soo much
your tutorials are first class
Thank you so much!
Thank You for this video. ❤
You're welcome
Your style of teaching is effective. I hope you get the energy to do something similar with Typescript. This series on JS is already one of the best ones on YT
Great suggestion!
Someone has been watching "Succession" hahaha hahahaha. Thanks a lot Sina, your content never let me down. Cheers!!
Thank you! Good show.
Also the no side effects is so important in state management and the core concept of libraries like redux. Never modify state directly. Only return an updated state
Yes!
Thank you for your efforts
You're most welcome
The best tutorials.
Ty!
Pure presentation of Pure func👍👍
Such a wonderful tutorial ❤ Would you do an episode about design patterns and maybe software testing in the future?
Good ideas
one of the best explaination i saw in the youtube 😄, Which code editor are you using?
Good sir , you are a gentleman and a scholar ❤
🙏
hey, I love your teaching style. please make a video on Garbage collection and circular referenced objects.
I was hapoy to see you in my notification panel
Coding fact: If you write a function that sets the CSS variable for Sina's hair to 'hidden' and attach an onClick, you can transform him into Stanley Tucci. Add a 0.5s ease-in-out for a smoother transition.
This is based purely on the thumbnail to this video btw..
Comment of the year 🏆
One reason I love typescript. It catches a lot of this
Your videos are really great ❤ thankyou.
I request you plz do videos on React Hooks
So creative representation.
🎉
Hey Sina! Wonderful video can youu tell me which editing software you use to edit your videos? Wow come on man sick editing!
Been waiting so long for this series to continues! So glad that your back!
Ty!
The inventor of fun JavaScript:
Great Job Sina! Amazing content.👑 Kindly post react content as well
Javascript legend is back 🥳🥳🥳🥳🥳🥳🥳🥳🥳🥳
🕺🏻🙇🏻♂️
I hope we get a "Qoli" face reveal by Episode 20 :)
Awesome video man!
It's a possibility 🤨
It can be argued that a function executing a console.log is an impure function, as its side-effect is writing to the console.
Absolutely correct
Can we have a video in unit testing? But I'll probably learn it by myself till then) but I love your videos and type of teaching, and of course, I love you ♥😍😍
Finally 🎉🎉🎉🎉🎉
🎉
Hi Sina, amazing work bro
I would like to suggest this topics for future videos:
💎 Getters and Setters
💎 Short circuit operator
💎 Event Propagation
Thanks for the quality of the content, greetings from Colombia
Salut to you as well, from Romania. Great series, my dude. You could fit right into a real brick-and-mortar University as a cool JS teacher.
Salut tot din Romania.
Hello Romania! 🇷🇴
Great video, great singing. I would add that while you can write pure functions in JavaScript, the language doesn’t support them the way some fancier languages do. For example in rust all functions are pure by default and the compiler guarantees this and you have to declare your intentions to be impure (to sin) by including self as an argument.
I been waiting since long 😭😭😭😭
Sir you’re an amazing teacher. I aspire to be as clear and concise with my videos as you are. May I ask how you do you color grade your videos (lut or preset?) bc they’re beautiful. Also how do you edit your self right beside your editor? Is it a template for your screen recording or editing software?
It's got more to do with lighting and a good lens than software. Watch some tutorials on lighting before getting into LUTs, then you can do color correction based on your environment.
wooooooohoooo you da best :))))
So are you
Waiting ... && ❤❤❤🎉🎉🎉
GOAT!
🐐
when is your course dropping ? cant wait!
Working on it as we speak. Make sure you join the list on www.colorcode.io
Amazing video thanks a lot Sina. BTW how do you get the code continuously running on the right pane? is that Quokka ? and how do you get it to run in a separate column?
It's called RunJS - Here's my affiliate link: runjs.app/colorcode
@@ColorCodeio Wow incredible! Thanks Sina :) BTW I love the Gholi cameos in your videos! Our beloved childhood friend ;)
Thank you for the amazing content!
Sorry about the awkward questions but I really like you glasses. Could you tell me the brand and the model, please?
Thank in advance and keep up with the videos you're doing!
www.warbyparker.com/eyeglasses/dawson/azure-crystal-with-oak-barrel
Really curious, what is the tool you are using for the live coding? Looks useful, particularly for learning / testing ideas.
It's called RunJS. Here's my affiliate link: runjs.app/colorcode
You deserve a lot more credits for your videos. ;)
Anyway, may I ask a video about the semi colon? Is it good, is it bad, why was removed... :D
I don't use them in these tutorials just to make things a little cleaner, and it doesn't really have an impact with some rare exceptions in return statements
@@ColorCodeioAh ok! Thanks! :D
Rule 1 : one-to-one relation
Hi, Please let me know how to use spotlight effect on Mac mouse, thanks!
boinx.com/mousepose/
what code editor you are using? i want that simplicity
RunJS.app/ColorCode
He actuallyt made me drink water.. thanks yo
Stay hydrated! 🚰
Starting at 3:00, how do you access this clear code editing space in the browser? Which browser is it? How do I access this window? It’s so clean!
RunJS.app/ColorCode
Can you please do a video about side effect?
I cover side effects in this video
I came looking for copper and found gold
hello, what font do you use ?
monaco
Extension for console??
RunJS.app/ColorCode
where is ur podcast :(
After the full JS course
aleluya! hehe
"JavaScript
MasterClass
Available Spring 2023" ...
Are you a syrian living in turkey ?
Bro he is definitely an Indian American
Neither
salut('Logan') never can be a pure function! It can unexpectedly return "Fu*k off" :))
Your videos are absolutely 🔥. Dude, dope a$$ jacket 🫡
Thanks! 🤘
The inventor of fun JavaScript: