ALL


  Create namespace in JavaScript

A namespace (sometimes also called a name scope) is an abstract container or environment created to hold a logical grouping of unique identifiers or symbols (i.e., names). An identifier defined in a namespace is associated only with that namespace. The same identifier can be independently defined in multiple namespaces. That is, the meaning associated with an identifier defined in one namespace may or may not have the same meaning as the same identifier defined in another namespace. Languages that support namespaces specify the rules that determine to which namespace an identifier (not its def...

5,675 0       JAVASCRIPT EXAMPLE NAMESPACE


  this in JavaScript

this is a keyword in JavaScript. It refers to an internal object created automatically when a function executes, it can only be used in a function. For example:        function test(){    this.x = 1;  }The this keyword will change when a function is called in different situations. However, the general rule is : this refers to the object which calls the function.Next we discuss the use of this in 4 different situations.1. In pure function callThis is the most common use of a function, it is a global call, so the this w...

5,864 0       JAVASCRIPT THIS KEYWORD USE


  Why you should be careful about optimizations

In one of my current javascript projects, I have to deal with 3D voxel coordinates. And, sometimes, I have floating points coordinates which must be converted to integers in order to convert them into proper array index.Javascript is a wonderful language, really. However, implementations are sometimes weird, and the way to do something can sometimes have very huge impacts on the performances. Worse, sometimes the classical way is more expensive than the tricky one.So, some people have made performance comparisons on jsperf to check which is the fastest way to do. Most of these tests sa...

3,393 0       JAVASCRIPT OPTIMIZATION TRICK BITWISE FLOOR


  Which programming language should I learn first?

Recently I saw somebody asked a question in a forum, the question is "Which programming language should I learn first?". Then someone answered this question. His answer:Depends.To program in an expressive and powerful language: PythonTo get a website up quickly: PHPTo mingle with programmers who call themselves “rockstars”: Ruby.To really learn to program: C.To achieve enlightenment: Scheme.To feel depressed: SQLTo drop a chromosome: Microsoft Visual BasicTo get a guaranteed, mediocre, but well paying job writing financial applications in a cubicle under fluorescent lights: Ja...

112,451 18       JAVASCRIPT C PROGRAMMING LANGUAGE LEARN


  JavaScript: Private variables

The first thing you often hear when talking about JavaScript is often “JavaScript doesn’t have visibility modifiers, hence it doesn’t support private variables”. This is only valid for 50%, because JavaScript indeed doesn’t have visibility modifiers (public, private, friend) but it has closures and function scopes. With these tools we can make variables private. Let’s take the following function:var names = ["Kenneth", "John", "Marc", "Robert"];var lookup = function (index) { return names[index];}alert(lookup(0));As you can see the variable “names&r...

4,594 3       JAVASCRIPT PRIVATE VARIABLE CLOSURE


  A Baseline for Front-End Developers

I wrote a README the other day for a project that I’m hoping other developers will look at and learn from, and as I was writing it, I realized that it was the sort of thing that might have intimidated the hell out of me a couple of years ago, what with its casual mentions of Node, npm, Homebrew, git, tests, and development and production builds.Once upon a time, editing files, testing them locally (as best as we could, anyway), and then FTPing them to the server was the essential workflow of a front-end dev. We measured our mettle based on our ability to wrangle IE6 into submission or a...

2,736 0       JAVASCRIPT FRONT-END BASELINE


  HTML Page Slide Without a Framework

The HTML5 Microzone is presented by DZone and Microsoft to bring you the most interesting and relevant content on emerging web standards.  Experience all that the HTML5 Microzone has to offer on our homepage and check out the cutting edge web development tutorials on Script Junkie, Build My Pinned Site, and the HTML5 DevCenter. I'm working on a little demo mobile application for an upcoming project, and I wanted to add sliding transitions between pages. Pretty simple, right? You just use jQuery, jQuery Mobile, zepto, or one of a bunch of other frameworks, an...

3,667 0       JAVASCRIPT HTML SLIDE SHOW NO FRAMEWORK


  JavaScript tutorial - Creating time delays

There are two ways of creating time delays with JavaScript. The first is more simpleand will simply wait for a specified amount of time before executing a function. The seconddoes the same but will repeatedly execute the function.Note, many browsers have a minimum delay length of between 25 and 75 ms, with some of the fastest browsershaving a minimum delay of about 3 ms. If a shorter delay is specified,the actual delay will be the minimum delay length. Even with higher numbers, the delay is never perfect. Mostbrowsers will take slightly longer than the time you ask for, typically just a few mi...

3,280 0       JAVASCRIPT TIME DELAY SETTIMEOUT SETINTERVAL