Posts Tagged ‘JavaScript’

ECMAScript 5 “strict mode” Alternatives

Monday, April 1st, 2013

ES5 offers a way to opt in to a restricted variant of JavaScript by adding strict mode to the top of a page or function. It can be used to access all of the language’s latest features, and have them work with full performance in modern browsers.

However, strict mode is what it sounds like — strict. It can be difficult to learn the new variants and rules. Fortunately ES5 offers other modes that can be used that are more accessible to average coder.

stern mode

Very similar to strict mode. It runs bad code, but tells you all the ways you screwed up and threatens that it won’t run the code next time.

permissive mode

Pretty much let’s you do whatever you want. It’s not happy when you use `with` or `eval`, but doesn’t do anything about it. It will occasionally throw errors, but they are unpredictable and passive aggressive. `switch` and `break` have been removed for being too confrontational and replaced with `praise` and `accept`.

A new exception is introduced for this mode: Fit(). When the feeling is the code is given too much lenience, it’s best to:

throw Fit();

coddle mode

Writes your code for you while you eat snacks.

This mode also includes new exceptions. Up() can be used if the code is taken to extreme. There is a special Party() exception which also returns a special promise. That way you can chain exceptions:

throw Party().then( throw Up(); )

While these new modes are helpful, the TC39 committee realizes they are still to restrictive to be useful is some cases. For ES6, the plan is to release subsections of each from which you can pick and choose. It will be called…

Wait for it…

ala mode

JavaScript Context, Call and Bind – Ninja Level

Monday, December 5th, 2011

In my previous article I showed the differences between scope and context, basic problems that arise and how to fix them. If you are just using some JavaScript and maybe jQuery, an understanding of scope is all that is needed to get you by. Once you start using objects or namespaces however, you’ll start to run into issues with context and will need to use the keyword this. But when you get into object oriented JavaScript, you’ll need an advanced understanding of context and how to make it work for you. To do this, we’ll use the call() and apply() methods, and then a backwards compatible version of the new feature Mozilla recently released in JavaScript 1.8.5 called bind().
JavaScript Function Context Bind

JavaScript Scope and Context – Not the Same Thing!

Tuesday, November 29th, 2011

In forums and other places I often see people incorrectly use the term scope when they should be using the term context. Scope applies to the variable and functional access of a function, whereas context is the property and method access of a function. Essentially, scope is function-based, and context is object-based.
JavaScript Scope

Simple and Easy JavaScript Inheritance

Tuesday, June 14th, 2011

For object inheritance, I had been using the traditional method of assigning methods and properties to the function’s prototype. Because my project was relatively simple, I could get away with this for a while. But as the project grew in scope, using the prototype started proving unwieldy. It worked, but the code was getting messy and hard to read. I decided it was time to implement an inheritance system. Not too complex, just something to help me organize my code. I ended up creating what I call my Declare Inheritance Helper.

Video: Hype Animation Tutorial

Monday, June 13th, 2011

hype-example New goodies are posted! First, I gave a tutorial of the Hype HTML Animation App. You can see the video here, and you can see the final results here.

And we also have Bob doing the Ajax News, where he focuses on an interesting blog and topic, The 11 JavaScript Mistakes You’re Making.

Presentation: Why You Need a Front End Developer

Thursday, May 12th, 2011

I had the good fortune to be invited to speak at the DFW JavaMug last night, and created a presentation based on one of my more popular blogs, Why Your Company Needs A Front End Developer. Instead of addressing managers or decision makers, this one was geared toward server side developers. The premise is simple, though difficult: before hiring a second (or another) server side developer, make sure you have a good front end developer in place — and don’t try to do it all yourself. Telling an end-to-end developer that he shouldn’t do it all turns out to be in conflict with human nature and business. Often these are developers who are trying to please, and looking to be the “go-to guy”.

Regardless, the web is changing, thick clients are becoming more common, and front end technology is getting more complex. It’s harder to be a generalist, and it’s time to start thinking about specialists.

See the presentation here.

Brendan Eich Redesigns JavaScript to Look Like jQuery

Friday, April 1st, 2011

“Obviously, due to the success of jQuery and the lack of base-knowledge of JavaScript”, Brendan explained at a recent gathering, “JavaScript is a huge failure. I’ve redesigned it to look like jQuery, and will implement it, retroactively, into the web.” (more…)

Meeting Tonight! New Location!

Tuesday, March 1st, 2011

Club AJAX is back on track after the Freeze of ‘2011™. Tonight’s presentations will be Bob Byron’s Simply JavaScript where he will be discussing the basics of JavaScript. Also tonight is Mike Wilcox’s HTML5 is Dead. Mike will discuss the latest craziness surrounding the HTML5 spec and the standards bodies.

We’ve moved!

We are still with Improving Enterprises, but they’ve moved across the street to 16633 Dallas Pkwy, First Floor Suite #110. See the map for details.

See you there!

Video: How to Build Web Apps

Monday, January 10th, 2011

A new video is posted from the January 4th 2011 Club AJAX meeting. Basic and advanced code for Ajax apps. The main subjects covered were CSS organizing, and OO-CSS concepts, and an HTML5 Video Player with custom JavaScript.

See the video here.

Dev vs Dev! JavaScript is a Toy

Thursday, January 6th, 2011

This is the second video in the Dev vs Dev series, using the XtraNormal movie maker. What does it sound like when a front end developer suggests to a back end developer that a project should use JavaScript? It might sound something like the following.