DEV Community

Cover image for πŸš€ Get better at web development: CodeSnacks 🍫πŸͺ🍩 Tutorial Tuesday Newsletter + one sweet JS hack!
Benjamin Mock
Benjamin Mock

Posted on

4

πŸš€ Get better at web development: CodeSnacks 🍫πŸͺ🍩 Tutorial Tuesday Newsletter + one sweet JS hack!

tldr: πŸš€πŸš€πŸš€subscribe to my web development newsletter and let's grow our skills as developers together!

13 is my lucky number. And this is my 13th article in my codesnacks series. So I hope I'm lucky and you forgive me for some self-promotion.

I write a couple of tutorials each week - mostly about JavaScript but also about web development in general.

Currently, it's mostly vanilla JS content but it will also be about React, Vue, Node.js, Svelte, or other topics. Primarily I write snackable content.

I try to communicate one specific idea or one trick I learned in less than 5 minutes, hence the name codesnacks.

If you'd like to receive a small newsletter every week with my tutorials and other stuff I liked, then please subscribe to my Tutorial Tuesday newsletter.


It will contain stuff like this:

πŸ’‘ Dealing with command line arguments in Node.js
Learn how to read command-line arguments in Node.js.

Coercion in JavaScript - πŸ€” do you know what it is?
Learn about coercion - implicit and explicit. Which methods use coercion and what the implications are.

const πŸ“¦, seal 🀐, freeze ❄️ & immutability πŸ€“ in JS
Learn about the Object.seal and Object.freeze method, their limitations and what distinguishes them from immutability

As a small thank-you I'd like to share one little hack with you to access the last element of an array:

So instead of doing it like this

const arr = [1, 2, 3]
const lastElement = arr[arr.length - 1]

You can also use slice and pop.

const arr = [1, 2, 3]
const lastElement = arr.slice(-1).pop()

You might ask why you want to use this syntax. Well, you don't need to save your array to a variable this way.

Let's say we want to get the last link of a webpage. You could do it like this, without saving the list of links into an additional array:

Array.from(document.querySelectorAll("a")).slice(-1).pop()

Want to get better at Web Development?
πŸš€πŸš€πŸš€subscribe to the Tutorial Tuesday βœ‰οΈnewsletter

SurveyJS custom survey software

Build Your Own Forms without Manual Coding

SurveyJS UI libraries let you build a JSON-based form management system that integrates with any backend, giving you full control over your data with no user limits. Includes support for custom question types, skip logic, an integrated CSS editor, PDF export, real-time analytics, and more.

Learn more

Top comments (2)

Collapse
 
diek profile image
diek β€’

Subscribed! Let's train! :D

Collapse
 
benjaminmock profile image
Benjamin Mock β€’

Awesome! Thank you!

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free β†’