Tag Archives: javascript

Computer Algorithms: Bubble Sort

Overview It’s weird that bubble sort is the most famous sorting algorithm in practice since it is one of the worst approaches for data sorting. Why is bubble sort so famous? Perhaps because of its exotic name or because it … Continue reading

Posted in algorithms | Tagged , , , , , , , , , , , , , , , , , | 2 Comments

JavaScript Performance: for vs. while

JavaScript Loops If you have read some preformance tests on JavaScript loops, you may have heard that “while” is faster than “for”. However the question is how faster is “while”? Here are some results, but first let’s take a look … Continue reading

Posted in javascript | Tagged , , , , , , , , , , | 3 Comments

Does JavaScript undefined Equals undefined?

Weird JS As you know sometimes JavaScript can be weird. Let’s see the following example and let’s try to answer the question: does “undefined” equals “undefined”. What do I mean? First take a look at the following code. var a; … Continue reading

Posted in javascript | Tagged , , , , , , , , , , , , , | 6 Comments

OOP JavaScript: Accessing Public Methods in Private Methods

As you know in JavaScript when you define a variable with the special word “var” the scope of this variable is within the function. So when you simply wite “var a = 5″ the variable named “a” has a global … Continue reading

Posted in javascript, micro tutorial, web development | Tagged , , , , , , , , , , , , , , | 2 Comments

A JavaScript Trick You Should Know

JavaScript Strings You should know that in JavaScript you cannot simply write a multilined code chunk, i.e. something like this: var str = ‘hello world’; This will result in an error, which can be a problem when you deal with … Continue reading

Posted in javascript, micro tutorial, PHP | Tagged , , , , , , , , , , , , , , , | 4 Comments