Published at
Updated at
Reading time
1min
This post is part of my Today I learned series in which I share all my web development learnings.

In July 2017 I wrote about ways to execute JavaScript snippets from your clipboard using process substitution. The snippet that I'm using since then to execute JavaScript snippets quickly is the following...

$ node <(pbpaste)

Today I came across a tweet by Julian Gruber and it turns out you use the pipe operator with the Node.js binary directly.

$ pbpaste | node

The result is the same but it looks nicer and feels better that using process substituion (<(...)). I have no idea how I missed this Node.js detail and checked the previous versions of Node.js and it works going down to Node.js v4 (that's what I have available on my machine). Good to know!

If you enjoyed this article...

Join 5.5k readers and learn something new every week with Web Weekly.

Web Weekly — Your friendly Web Dev newsletter
Reply to this post and share your thoughts via good old email.
Stefan standing in the park in front of a green background

About Stefan Judis

Frontend nerd with over ten years of experience, freelance dev, "Today I Learned" blogger, conference speaker, and Open Source maintainer.

Related Topics

Related Articles