3 hours ago · Tech · hide · 0 comments

I love learning something new that’s core to the JavaScript language syntax! A code exercise I completed today did just that. Via this comma, items is returned. const removeItemAtBottom = (items) => (items.shift(), items); const cards = [1, 2, 3, 4, 5]; removeItemAtBottom(cards); // [ 2, 3, 4, 5 ] This helps us around the fact that shift() returns the removed item, 1, rather than the list of items that we modified. It works outside a function as well:

No comments yet. Log in to reply on the Fediverse. Comments will appear here.