Category Archives: JavaScript

The React.js Venture

Greetings!

ReactLogoI am just now starting my adventure into React.js.  There is one project I have been on that is Angularjs but there are some others in the enterprise that are React.js.

So far I have done the quick Tutorial: Intro to React at the React site.  I am also in the middle of the PluralSight course React.js Getting Started by Samer Buna.  Obviously I have not looked at any serious production source code yet.

Read the rest of this entry

Left or Right Curly Braces

Should you put your curly braces on the left or right?

function foo(){
    //My curly brace is on the right.
}

function bar()
{
    //My curly brace is on the left.
}

Read the rest of this entry

The JavaScript Object Literal

I have been really trying to beef up my JavaScript skills lately.  One really interesting aspect from this experience is how cool I find the object literal.

You can use it to create really any kind of data structure you desire.  It can hold the primitive types like strings and numbers, it can hold objects like arrays or other object literals, and it can store functions.  I created a fiddle at JSFiddle to demonstrate the object literal.

Here is the JavaScript for my object literal which I call oPerson.

var oPerson = {
    firstName: "John",
    lastName: "Doe",
    age: Math.floor((Math.random() * 33) + 17),
    "favorite color": "Blue",
    Interests: {
        movies: ["The Blob", "History of the World Part 1", "Ferris Bueller's Day Off"],
        bands: ["Lacuna Coil", "Soft Cell", "Naked Eyes"]
    },
    greeting: function () {
        return "Hello, my name is " + this.firstName + " " + this.lastName + ".";
    }
};

Read the rest of this entry