Aug 26, 2018XSS aka HTML Injection Attack explainedOriginally published at jamischarles.com. I’ve been doing web dev for about 10 years now, and I’ve always found the term XSS to be very fuzzy. I knew was a term related to JavaScript in security in the browser, and it’s usually demonstrated via alert(), usually passed by url params. Recently…Security5 min readSecurity5 min read
Aug 19, 2018What is {…obj} in JS?I remember first encountering this syntax several years ago when I started using Redux: This is the object spread operator, first introduced to JS in ES2018. As of this writing it’s available in Chrome, Node and a handful of mobile browsers. Before object spread Here’s how updated objects before spread in an immutable manner:JavaScript2 min readJavaScript2 min read
Aug 12, 2018How to chain functions in JavaScriptOriginally published at jamischarles.com. Here’s a question you’ll sometimes encounter in interviews: How do you write a chaining function similar to jQuery in JavaScript? The benefit is that we can mutate the same element with several method calls. The key detail is that each method call must return an object with methods we can call. Here’s how you do it:JavaScript1 min readJavaScript1 min read
Aug 5, 2018tiny-redux: Writing Redux from scratch for learningWhen I encounter a new piece of technology I always try to answer these questions first: What problem does this solve? Why would I need this? How would this fit into my existing stack? What’s the simplest way for me to try this out and get familiar with it? If…React2 min readReact2 min read
Jul 29, 2018What is Debouncing?Debouncing is something that comes up fairly frequently in UI development. In the last few years I’ve encountered several interview questions where debouncing was the solution. So here’s a brief overview of debouncing. What is debouncing? Debouncing a function ensures that it doesn’t get called too frequently. Why debounce? What problem does it solve? Say you want to move a…JavaScript2 min readJavaScript2 min read
Jul 22, 2018Redux without the boilerplateI remember several years ago when I first heard Pete Hunt talk about React at a conference. What is this thing? Virtual dom? Everything in the same file? Seemed wild. Then about 6 months later, at my new job at PayPal I sat down and took an earnest look at…React3 min readReact3 min read
Jul 14, 2018What is a Test in JavaScript?I remember watching a talk on testing JS by Christian Johansen, the author of https://www.tddjs.com/. I was just getting into testing JS and it was all still mystery to me. The moment he explained what an assertion is by writing an assert() function from scratch everything just clicked. I think…JavaScript2 min readJavaScript2 min read
Jul 8, 2018Using import/export in node.js with esmOriginally published at jamischarles.com. When I started using node 6 years ago I took a quick liking to module loading in node. require() is pretty straightforward. You import with require() and export with module.exports. 2 years ago when I started using es6 import / export syntax on the client with…JavaScript2 min readJavaScript2 min read
Jul 1, 2018Easily Share a React Native App during developmentSo I’m building a React Native app for a client, and I want to show him the progress I’m making. Luckily, by using Expo, its really easy to share your app during development. First, you’ll need to tell your client to download the expo client on their iOS or Android…React Native2 min readReact Native2 min read
Jun 24, 2018What is Middleware? A simple explanation.Originally published at jamischarles.com. If you’ve used Ruby on Rails, Sinatra, Express.js or any other modern web framework, you’ve likely encountered the term Middleware. In this short post I’ll explain what middleware is, and how to write your own. Most of my explanation will be in the context of a…JavaScript4 min readJavaScript4 min read