56
Oct 26 '21
Avocado*
46
u/Darmok-Jilad-Ocean Oct 26 '21
Make a JIRA ticket
21
u/nullol Oct 26 '21
No time. We gotta get this to production.
11
6
u/jayedeem Oct 27 '21
Be an interesting retro
4
u/Darmok-Jilad-Ocean Oct 27 '21
What went well: Teamwork!
What didn’t go well: Didn’t meet sprint goal
What we can improve: Other teams did bad stuff!
33
Oct 26 '21 edited Oct 26 '21
FYI, doesn't work on Edge 18 and below, IE and SafarIE (20% of users theoretically use these)
16
19
u/queen-adreena Oct 26 '21
IE doesn’t support flex, scrolling, or the colour green either. Who cares.
5
Oct 26 '21
Me, one of the bigger clients using my company's SaaS uses IE. Throwing money away to not support them atm.
9
4
6
u/Dodgy-Boi Oct 26 '21
array.reverse()[0]
5
u/NekkidApe Oct 27 '21
In case anyone is using this... It's mutating the original array
1
u/Dodgy-Boi Oct 27 '21
I saw a huge battle about index. And came up with another solution (I honestly tried to make it as ridiculous and/or unique as possible).
2
2
2
Oct 27 '21
Too slow, unfortunately. Accessing a value in an array using an index should be in O(1) time complexity.
2
u/Dodgy-Boi Oct 27 '21
I am front end. My calculations are happening on client. I don’t care about either users with old devices nor your O nor your o nor * of yours; all I care about is the ( . Y . ) (not necessarily yours)
partially /s
2
1
u/delventhalz Oct 26 '21
This is nice, but I kind of just want a last method. That would solve 99% of the use cases I might use at for.
While I’m at it, head and tail would be nice too (though brackets/slice work well enough for those).
4
1
u/gigraz_orgvsm_133 Oct 26 '21
wouldn't
fruits[fruits.length - 1]work?4
u/delventhalz Oct 26 '21
In some cases. Not if you are chaining. And it is tedious in all cases.
1
u/Notimecelduv Oct 28 '21
If you're chaining methods, you can just use the
arrargument in the callback function.2
u/delventhalz Oct 28 '21
That doesn't really apply here. Say you are trying to
filtera list of numbers to just be even numbers, and then grab the last one. Thearrparameter infilterwould not help you. You would need an intermediate variable.const evens = nums.filter(n => n % 2 === 0); const lastEven = evens[evens.length - 1];You could chain on a
reduceand use thatarrjust to grab the last one. That is super hacky though, and extremely wasteful.const lastEven = nums .filter(n => n % 2 === 0) .reduce((_, __, ___, arr) => arr[arr.length - 1]);However, a
lastoratmethod would allow you to do this without the intermediate variable, and without the weird hacky extra iteration in thereduce.const lastEven = nums .filter(n => n % 2 === 0) .last();
1
1
1
u/gniziemazity Oct 27 '21
It's always interesting to see how languages evolve, but not so great when the update only affects some browsers... I usually keep it safe and use established features only.
1
0
0
Oct 26 '21
[deleted]
5
u/great_site_not Oct 26 '21
For lots of people, when they come from a language like Python where you can just do
array[-1], having to write outarray[array.length - 1]every time is a genuine annoyance. It's a phrase that people have to write pretty frequently, it's nice to have shorthand.2
u/technicallynick Oct 26 '21
That's fair. However -1 is used to signify that the index wasn't found for the item you're searching for in most cases. I'm just seeing this as muddying the waters.
0
Oct 26 '21
go back to assembly then
0
Oct 26 '21
[deleted]
1
Oct 27 '21
Cause you can express simple stuff in complex ways, obviously.
Instead of just writing "at(-1)" - you can write over 20 lines of code with weird register check operators and jumps and all that good stuff!
28
u/HyerOneNA Oct 26 '21
Why use the at method when you can just use square bracket notation?