If it’s faster to use object literals or other forms of object creation in JavaScript, why would anyone use the “new” keyword and constructor functions? Does it make a difference when it comes to the application performance vs the readability and expressed intent of the code? In this episode of ThoughtsOnCode, Derick answers these questions […]
How Does A JavaScript Function Define A Type And Create Object Instances?
I recently received a question from someone going through my Mastering JavaScript “this” email course, regarding day 3 of the course, where I talk briefly about constructor functions and the “new” keyword. In this course, I say: The value of “this” inside of the constructor function is a new instance of that object type, where […]
Fun With Higher Order Functions In JavaScript
JavaScript is often referred to as a language with functional programming capabilities because of it’s “higher order functions” – a term that may sound fancy, off-hand, but turns out to be simple in practice: A higher order function is a function that can return another function. It’s a bit like a opening a present and […]
Hide The Backing Variable Of Object Properties/Attributes Using ES6 Symbols
ES6 includes a new feature called Symbols that allow you to do a number of very interesting things (if you haven’t heard about symbols yet, check out the ExploringJS chapter and my own WatchMeCode videos on the ES6/Symbols). In my exploration of ES6 Classes, I found a very interesting use case for Symbols… one that […]
Some Problem(s) With Implicit Code: “options.change && options.change()”
I started a small … umm… argument via twitter (imagine that) about code readability a while back. It all started with this tweet: #ProTip your job is not typing. code should communicate intent to other humans, not save keystrokes for compilers. pic.twitter.com/rOqQX42md5 — Derick Bailey (@derickbailey) July 2, 2015 Shortly after, I received this response: […]
How Do You Think In A More Object-Oriented Manner?
It’s a question I recently received from a reader of my mailing list. The person asking was wondering how to get out of the procedural mind set that he was in, having multiple failed attempts and building software in an object oriented manner. And I was stumped for a while. I had to dig deep […]