Are You My (JavaScript Object) Type?

So there are several object types available in JavaScript as many of you would be aware. For those playing at home, the list is as follows:

  • Array;
  • Boolean;
  • Date;
  • Function;
  • Number;
  • Object (how meta!);
  • RegExp; and
  • String

Each of these objects has a different coercion with one another, and the order that such interactions occurs can also affect the result.

Such coercions are done with JavaScript’s operators, in the form of:

 <OBJECT_A><OPERATOR><OBJECT_B>

The operators commonly used when coercing objects are:

  • The unary operator (+), commonly used for coercing an object to a number;
  • The negation operator (-), not as commonly used as the unary operator, but can also be used to coerce an object to a number;
  • The concatenation operator (also represented by +), used to join strings; and
  • The Logical NOT operator (!), used to coerce an object to a Boolean value.

Now, while these are a small sample of the available operators in JavaScript, these are the ones generally used for coercing an object type into another object type.

I’ll be talking about each of these operators in upcoming posts.

As always, more later!

alert(“Hello World!”);

Hi quirky coders abound!

This blog has been created for the sole purpose of bringing a little JavaScript enlightenment to your lives. My intent for this blog is to provide some insight into the crazy coding quirks of JavaScript, namely in the way of code golf and coercion quirks and how these can be used and abused in your every day code.

I’ll be showing some crazy stuff with every passing post, and I may also get you involved in a little project or two along the way. So, with that little morsel of what this blog is about, I’ll also give you a little intro about myself.

My name is Eliseo D’Annunzio, I’ve been in the IT industry for the past 20 years, and have a love for coding… I love quirky things, and JavaScript happens to fall within that category. I’ve recently been working on a number of projects which involve JavaScript, and I’ll hopefully be releasing a few of these soon. I’ve also been experimenting with the extent that I can code with non-alphanumeric JavaScript, and I’ll be making strong mention of this throughout this blog.

I hope I can educate and entertain you with my own findings and little words of wisdom. Feel free to make the occasional comment or ask a question if you like, and I’ll see to responding to them when I can.

More later!