Learn by Example

Always Do… Learn by Example.

While studying theory, do write out code examples as a proof of what you are trying to learn.

Practice makes you more efficient and helps to develop a deeper understanding.

In my experience with coaching individuals that that starting off, some tend to read/study and only take notes. Then when it comes time to explain a concept, they struggle. Practice, practice, practice… and always write code.

Don’t limit your potential by cutting corners by not writing out code to demonstrate what you are learning. Get your hands dirty and dive in.

Understanding Javascript’s this

I was recently asked what this means while reviewing some toy javascript problems.

There are a few different contexts for this and it is important to review them all, but for the shortest answer, this refers to the element that is executing the code.

This can mean different things depending on the context.

Global Context – Within the global scope, this refers to the global object and in most cases this is the window object.


console.log(this === window); // true
foo = "bar";
console.log(this.foo); // bar

Function Context – Within simple functions calls, this refers to the object that the function is running on. If the function exists in the global scope, then this refers to the window/global object.

function func() { console.log(this); }
func(); // within the browser = window | within node = global

If the function is nested within another scope/object or run with bind(object) , then this refers to the object executing the function.

var testObj = {
name: "foo",
whatIsThis: function() {
console.log(this);
}
}
testObj.whatIsThis(); // {name: "foo"; whatIsThis: f}

.. to be continued

Hack Reactor – Week0

I have never been this excited to dive into a lot of content, lack of sleep, and experiment with technology and web solutions.

I walked onto the program with graphic/web designer experience. I spent the last two years understanding and studying Magento CE, and trying to squeeze in time to learn iOS, Javascript, Java, User Experience/User Centered design and more. The little bits of information that I have taken the time to learn has left me in a limbo of knowledge. My main goal and intent of joining this program is to solidify my pervious knowledge and form expert Javascript skills.