Skip to content

TheHippo

if (i=1) throw null;

Archive

Tag: JavaScript

I am developing with JavaScript for a while and I am used to a lot of it quirks. But even after years of using this language you still find new curiosities. Today a struggled a while with this one.
Considering this piece of JavaScript code:

  1. var i = 10;
  2. function foo() {
  3.         i++; // i is now 11
  4.         console.log("foo1: "+i);
  5.         i = 0; // i is now 0
  6.         console.log("foo2: "+i);
  7. };
  8. console.log("global1: "+i); // should be 10
  9. foo();
  10. console.log("global2: "+i); // and now 0

Ok. That’s fine. Now we change the code a little bit to this one:

  1. var i = 10;
  2. function foo() {
  3.         i++; // is now 11
  4.         console.log("foo1: "+i);
  5.         var i = 0; //create a new variable with value 0
  6.         console.log("foo2: "+i);
  7. };
  8. console.log("global1: "+i); // expect: 10
  9. foo();
  10. console.log("global2: "+i); // expect: 11

What do you expect? I was quite surprised: continue reading…

In the last time I am back to a lot of server development. This also means a lot of database engineering. For the most the time I have used PHPMyAdmin for nearly every I have to work with a MySQL database. After a while a got a little bit disappointed, because PHPMyAdmin is a kind of bloated and sometimes it’s just take to long to perform a simple operation. continue reading…

Minefield icon

I make no secret of that I am a big fan of the Firefox web browser. Except of a few things that I will name later I am/was always impressed by the speed improvements that are made over the past few years, which seems very important to me, because many pages you use in you daily life are more and more based on heavy JavaScript functionalities. A few days ago I decided to give a try to the newest development version of the Firefox – named Minefield – and make some tests. continue reading…