Tag: JS
-
Node.js built in test runner
For the longest time, I’ve been using Mocha (test runner) and Chai (assertion library) for my JS testing. They are reliable old friends. One of the effects of the existence of Bun and Deno has been to spur Node onto adding some new features, so after appearing as an experimental feature in 18, the Node…
-
A bit of web-scraping with Cheerio
I had an idea for a little holiday project that required a list of episodes from The Rest Is History podcast. On their ‘Episodes’ page, they have a player, and a list of post entries for the most recent eighteen podcasts. There is a ‘show all’ button, but it doesn’t work. The player does contain…
-
React code is not HTML
I was looking at this ugly code in a React app: Since I don’t need any of those CSS properties to change at any stage, I could just convert it to pure HTML/CSS right? Well no: The newbie trap I’ve fallen for here is that although that <div style= tag looks like HTML, it’s actually…
-
De-structuring objects in JS
I’ve worked through my first React tutorial app, and obviously that’s a lot – I’m struct by how messy mixing HTML, JS and React is. One language feature that’s being used quite a bit, and that is apparently a JS ability I’d never seen is ‘destructuring’ object properties. It’s very cool and obviously useful. It’s…
-
Calculator
I’ve been doing a bit of driving during the holidays, which means a lot of podcast listening. An episode of JavaScript Jabber about JS features you should never use sparked my interest in eval(). eval() takes whatever you pass it in a string and executes it in the JS engine. This is a crazy concept…
-
CWD – 185 – Problem solving
Line 10 When I’m looking at a function, I’d prefer not to also have to hold global state in my head – so I’m all for functional programming as far as that goes. I’m less concerned about side effects, so I wouldn’t always bother to copy a parameter like this, but the argument is stronger…