Debugging JavaScript with the debugger statement

One of the most useful statements in JavaScript is debugger. It invokes any available debugging functionality from your application and has no effect if there is no functionality available. So, for example if you have some JavaScript running and you want to pause...

Testing forms with React and Enzyme

Lately at Brave I’ve been adding unit tests for our React code. For our project we use: Mocha – our test framework Sinon – for spies Assert – for assertions Mockery – for mocks We also use React and ImmutableJS (not related to testing!)...

Sharing Styles with React and Aphrodite

Lately I’ve been using Khan Academy’s Aphrodite in a lot of my projects. React and Aphrodite work very well together! (although React is not a requirement) and makes managing CSS a lot easier! Using React and Aphrodite together makes each component look...

How to create React components

There are now three ways to create React components in JavaScript. Let’s take a quick look at each of them and discuss the pros and cons! Create React Components with React.createClass The first way, and the way Facebook still uses is the createClass method. It...

substr vs. substring in JavaScript

The difference between substr vs. substring in JavaScript bites me more often than any other API confusion in the language. The only difference is in the second parameter. Do you know what each of these will return? var word = "The quick brown fox";...

What’s new in Chrome DevTools 2016

I just finished watching this awesome video from Google I/O in which Paul Irish and Sam Saccone profiled a few websites and talked about some great new Chrome DevTools features that are available now on Chrome Canary. If you want to watch the whole video, check it out...