My Professional React & Next.js course is OUT NOW now! Find it here: bytegrad.com/courses/professional-react-nextjs -- this is the #1 resource to master the latest React & Next.js, my absolute best work.
Thank you! I've learned a lot :) Just a small detail: the polyfill at method as it is written only works with -1, but it breaks with -2, -3, etc... You just need to change that first if statement to this: if(index
Thank you for the great video. I hadn't taken the time to properly understand polyfilling and didn't realise frameworks like NextJS provide some polyfilling for users. This was really well explained and demonstrated in 9 mins!
If your implementation is not to spec you will get inconsistent behaviour across browsers. Always redefining means possibly not to spec but atleast its consistant which is way better imo. Didn't know that ??= was a thing, pretty cool syntax
Some people are not using Next.js or even not using React at all. It would be cool to hear couple of words about how Vite handles transpiling and polyfilling 🤔
Shouldn't it be... ``` Array.prototype.at = function (index) { if (index < 0) { return this[this.length + index]; } return this[index]; }; ``` to make it more dynamic, cuz passing a negative index to the .at method on your polyfilling solution will always return the last item of the array?
Great very well explain, Thank you so much brother. I have one more questions If some has their backend (apis) which is written in java and have own users registration and login feature using jwt. Then the nextjs is good for it.
@@VELIXYZbecause length + negative index will return length - the index. If you use +, it’s going to change to length + the index, which isn’t what we want in this case
I would agree that it is less obvious for the negative index, but it will become commonly used over time & went he given a second thought by then. For positive indexes, I think it’s 100% obvious, given the naming (even more so than [0] would be for a beginner too).
My Professional React & Next.js course is OUT NOW now! Find it here: bytegrad.com/courses/professional-react-nextjs -- this is the #1 resource to master the latest React & Next.js, my absolute best work.
Thank you! I've learned a lot :) Just a small detail: the polyfill at method as it is written only works with -1, but it breaks with -2, -3, etc... You just need to change that first if statement to this: if(index
Oops, should be + index indeed, not - 1. Thanks!
figured it out the same. that shows that we love this content and we are learning a lot, thanks and more content to come
Great video, I especially liked the polyfill and "this" explanations.
Glad you liked it 😁
Thank you for the great video. I hadn't taken the time to properly understand polyfilling and didn't realise frameworks like NextJS provide some polyfilling for users. This was really well explained and demonstrated in 9 mins!
Happy I discovered your channel. Please add more fundamentals js nowledge videos. Cheers !
Thanks, will do!
You explain things really well, very informative and interesting video once again. Thank you very much! 🙏🏽
I didn't know you could use the .at() method on strings too, very nice !
your explanation is so good
also use ??= instead of = while defining the prototype function
so you dont overwrite the native one if it exists already
If your implementation is not to spec you will get inconsistent behaviour across browsers. Always redefining means possibly not to spec but atleast its consistant which is way better imo. Didn't know that ??= was a thing, pretty cool syntax
Incredibly video. I've learned alot
Some people are not using Next.js or even not using React at all. It would be cool to hear couple of words about how Vite handles transpiling and polyfilling 🤔
I like you. I think your channel is starting to boom.
Thanks, hope so
Explained it well, good vid! I do recommend you try and adjust your audio settings, your voice is pretty quiet.
Thanks, will do!
Thank you!
It increased my knowledge.
Finally we have the syntactiv sugar of Python with negative index
wow many good valuable information in one 9 min video
Your delivery is a cure for insomnia, my friend. I came to learn about ".at" and ended up with a 3 hour nap.
Shouldn't it be...
```
Array.prototype.at = function (index) {
if (index < 0) {
return this[this.length + index];
}
return this[index];
};
```
to make it more dynamic, cuz passing a negative index to the .at method on your polyfilling solution will always return the last item of the array?
Oh nvm, someone already noticed it
Great very well explain, Thank you so much brother. I have one more questions If some has their backend (apis) which is written in java and have own users registration and login feature using jwt. Then the nextjs is good for it.
When are you launching React and next.js
tutorial videos?
Just opened :)
6:52 On line number 22 I think "-1" should not be hard coded.
What if I want to get the second last item from the array? Then it will not work.
I agree with you, I would use
this[this.length + index]
Yes, that was a mistake. Should be + index indeed, not - 1. Thanks
@@EdwinVanAssenwhy length + index and not length - index
@@VELIXYZbecause length + negative index will return length - the index.
If you use +, it’s going to change to length + the index, which isn’t what we want in this case
@@veedjohnson ahh heck, i got it. Forgot that we use negative index
very nice!
What theme ur using? I like the colors
I’m using [ ] expression with “noUncheckedIndexedAccess” eslint option
I feel like all these 9 minutes can be summed up in a small 60 second short.
So sum it up in 60 seconds short and share it
Why is polyfilling so strangely named?
you didnt say why you use at instead of []
-1
you can just .at() whenever u need negative indexing, otherwise .at() runs the risk of a null pointer with no benefit
Wauw
Cleaner syntax, but less obvious. I prefer obvious.
i dont know how it could be "less obvious"
I would agree that it is less obvious for the negative index, but it will become commonly used over time & went he given a second thought by then.
For positive indexes, I think it’s 100% obvious, given the naming (even more so than [0] would be for a beginner too).
bro i love your videos but talk slowly u are so fast