5 Must Know JavaScript Features That Almost Nobody Knows

preview_player
Показать описание
🚨 IMPORTANT:

JavaScript is a vast language with tons of features and it is impossible to know them all. In this video I will be covering 5 features in JavaScript that nobody knows but are incredibly useful.

📚 Materials/References:

🌎 Find Me Here:

⏱️ Timestamps:

00:00 - Introduction
00:41 - Nullish Coalescing
04:37 - Styling Console Log
06:19 - Optional Chaining
12:45 - Object Shorthand
14:55 - Defer/Async Loading

#JSTips #WDS #Top5JS
Рекомендации по теме
Комментарии
Автор

For the first one, just use default assignment for the arguments (e.g. `calculate(taxes = 0.05, description = "Default item")` – This only uses the default value if the value is `undefined` and not for `null`, which may be want you want for most cases, given the difference of meaning that they have, rather than treating them the same. This avoids a lot of unexpected behaviors and is more likely to throw type errors or invalid values at you so you can find and correct it quicker.

You can also use object destructuring in arguments with default values, like `calculate({ price = 0.05, description = "Default item" } = {})`. Default assignment makes it more readable and behave more consistent with ECMAScript norms with regards to undefined/null values.

dealloc
Автор

The person?.address?.street is going to save me SO MUCH time in React

JasonBoyce
Автор

13:40 it's striking through "name" because it assumes you're writing for a browser and the "name" property exists in the global scope (on the "window" object). It's trying to save you from confusion, although AFAIK this doesn't in fact create any problems.

SergeyNeskhodovskiy
Автор

03:05
Kyle: you're not use to see question marks in javaScript
Ternary operators: are we jokes to you?
:D

dines
Автор

I'm proud to say that I knew and use these features nearly every day. Great video Kyle, I really like your channel!

KeganVanSickle
Автор

The console log styling blew my mind. You learn something new every day I guess...

quickcodingtuts
Автор

Even when I think I already know this stuff, I always learn something new. Had no idea you could use optional chaining with functions and arrays, though I'm not a huge fan of how it looks 😅

Ayomikun
Автор

Came for optional chaining and ended up staying for the full suite. All super valuable, great work and thank you!

Jshanks
Автор

U can't imagine how happy I am knowing that I already know and use all these features except the console styling thank you so much I have learned a lot from ur channel

reyanrahman
Автор

When I discovered optional chaining in Ruby a few years ago it literally changed my life. So happy to see it eventually made it to JS

bradchellingworth
Автор

Optional chaining is exactly what I needed. Been struggling with a desktop app breaking because we were getting unexpected nulls. Thank you!

nathanbustamante
Автор

I have to admit, I thought it would be mostly things I was familiar with but I wanted to make sure so I gave it a watch. All five items were new to me! Teaching me both ES and to not make assumptions about my current knowledge. Thank you!

miklov
Автор

If you're a React developer, note that Babel 7.8.0+ supports the new ECMAScript 2020 features by default, which includes nullish coalescing (??) and optional chaining (?.). So you can use them in your project without worrying about legacy browser support.

multiwebinc
Автор

13:30 This is really good to use if you need to build deeply nested complex objects (maybe to turn into JSON).
You can build it inside out by building the inner most objects, then just including them in their parent, all the way up to the root element.
Much more readable and flexible as every sub-object has a reference, and you avoid the Xmas tree of deep nesting.

coolworx
Автор

Wow the console log styling is going to be helpful, and adding that '?' check before accessing a variable of something really saved me.
Thanks so much Kyle!!

MiSt
Автор

Very clear explanation! Thank you.
Nullish Coalescing and Optional Chaining, my 2 new tools ✌🏼

sudarshankj
Автор

Optional chaining saved my life numerous times.

kosemekars
Автор

never seen or heard styling console log before. you are gem.

yousufkhan
Автор

All of these tricks were incredible... hats off!
Thanks for spreading a little wisdom over us all!
These were all pretty neat tricks I can see myself using in the future.
Can't wait for more!

emmettdja
Автор

I thought it was going to be a useless video with stuff I already know. But it turns out most of the features in the video it could have helped me solve problems right yesterday. Thank you so much.

juniordantas