Inheritance in JavaScript

As I have already mentioned I am .NET developer and something what is natural for js for me is just strange, one of such things is that JavaScript has only functions. Authors of other languages developed a lot of stuff, for example in C# we have:

  • Classes (static, abstract and usual)
  • Structures
  • Interfaces
  • Enums
  • Methods
  • Properties
  • Arrays
  • Delegates
  • Events
  • Anonymous Methods
  • Partial methods and classes
  • other…

Continue reading

Stupid facts about JavaScript #1

During the first week of learning JavaScript I have found a few things that just confused me, things in which I could not believe until I test it, and today I am going to share some of them with you.

All of you familiar with holy wars at work regarding “Java or C#”, “comment or not comment”, “test or not to test”, “spaces vs tabs” etc. It’s like “to be or not to be” for developers, but it’s almost nothing in comparison with next lines of code:

var func = function(){
 // some logic here

 return {
 //some result here
 }
}

<strong>VS</strong>

var func = function(){
 // some logic here

 return
 {
 //some result here
 }
}

What might be wrong here? Does it really matters what code style we are using in this case and where that curly bracket is? Continue reading

Single Page Application from scratch. Part 1: Simple Event Emitter on JavaScript

I am .Net developer for more than 4 years, I was working with almost all aspects of .Net development from Console applications to Web, Windows Phone, WPF, WWF and services. And all that time I was bad in JavaScript. Only a few days ago I understand that I need to change it as too many interesting things currently happen around Web.

This will be my first blog from the series in which I will build MVC like Single Page Application (SPA) from scratch using native JavaScript, HTML 5 and CSS.

Continue reading