google docs  LogoFormatting Code Samples in a Google Docs Document

I recently worked on a project for a client that required adding JavaScript code samples to the documentation. At first I made a very bad assumption that there was no way for formatting code in a Google Document, so I started out using images of code samples. What a waste of time. Finally, it occurred to me that this must be a common challenge. It turns out that there are two tools available: “Code Pretty,” and “Online syntax highlighter like TextMate.”

READ FULL POST


JavaScript LogoTwo Ways to Dynamically Append an Element to a JavaScript Array

I’ve been providing some candidate pre-screening services for recruiters recently, and one of the classic JavaScript interview questions is: “Name two ways to dynamically append an element to a JavaScript array.” Some folks nail that question, but some are left scratching their heads. So I thought I’d quickly re-visit the logic behind this concept.

READ FULL POST


MongoDB LogoGetting Started with Mongo Shell Scripting – Basic CRUD Operations

In the article: “Getting Started With the Mongo Shell – Basic CRUD Operations“, I covered the basics needed to perform CRUD operations on a MongoDB database, using the mongo shell. All of the examples in that article were in real-time. This is perfectly acceptable, and there may be cases when you will want to perform administrative tasks manually. But it is also possible (and more likely) that you’ll want to create a script that executes a batch of mongo shell tasks. Since JavaScript is the language used to interact with the mongo shell, we can pass a JS file to the mongo command in a terminal.

READ FULL POST


JavaScript LogoWhy is a JavaScript Array’s Length Property Always One Higher Than the Value of the Last Element’s Index?

The “length” property of a JavaScript array is a very helpful tool, but why is it always one “off”

READ FULL POST


JavaScript LogoWhat is the Difference Between Scope and Context in JavaScript?

When interviewing front-end developers, I usually try to include a question about Scope and Context in JavaScript. I always ask what the difference is. The answers I get often surprise me. It seems that even those with some experience have difficulty answering this question.

READ FULL POST


JavaScript LogoAngular2 HTTP Observables in Five Minutes

Managing asynchronous activities in any JavaScript-driven application can be tricky. Every framework / library has an approach, and there are proven design patterns that are worth considering. In Angular 1.x, $q is the engine that drives this. In Angular 2, it’s RxJS. This technology is not for the faint at heart. It’s very cool, and works well, but does take some getting used to.

READ FULL POST


JavaScript LogoWhat’s the difference between jQuery.ajax(), jQuery.get() and jQuery.post()?

Although it is a good idea to understand Ajax in the context of native JavaScript, leveraging the power of JavaScript libraries for your Ajax calls is not a bad idea. Depending on the size and complexity of your application, it can often minimize the amount of code you need to write in order to provide the best cross-browser experience.

READ FULL POST


JavaScript LogoExecuting an Array of JavaScript Functions Using the shift() method

Both jQuery and Dojo offer their own flavor of “Deferred” functionality. This is a pretty deep topic that, while a bit challenging, offers tremendous power with respect to queuing up an invocation of multiple functions in an orderly manner. One concept that plays into this way of thinking is using the JavaScript array object’s shift() method to easily fire off some functions in order, even when you don’t know ahead of time how many there will be.

READ FULL POST