Joined July 2013

Christian Weber


@vohof What exactly do you mean? Seems fine for me?

Nice read! Very well written... just posted something similar ... seems like you had been first :D Well played... well played.... always good to share the word of awesome new web features. :)

Posted to JavaScript inheritance for Beginners over 1 year ago


Thank you! :)

Posted to (Re)Learning Javascript the Right Way over 1 year ago

Nice one! Always good to keep own skills on track of time. However, instead of parseInt you can also use double not bitwise operator ~~. Its much faster than parseInt() and with the same result, even without the second argument. :)

var base = Number(45.232);
console.log(parseInt(base)); // outputs 45
console.log(~~(base)); // also outputs 45

You can checkout a jsPerf comparison

Posted to Gameloop - the correct way over 1 year ago


Thanks! But with the polyfill by Erik Moeller you're quite ready for older browsers without requestAnimationFrame and up to date browsers, as this includes an alternative setInterval fallback. :)

// requestAnimationFrame polyfill by Erik Moeller
var lastTime = 0;
var vendors = ['webkit', 'moz'];
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
    window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
    window.cancelAnimationFrame =
      window[vendors[x]+'CancelAnimationFrame'] || window[vendors[x]+'CancelRequestAnimationFrame'];

if (!window.requestAnimationFrame)
    window.requestAnimationFrame = function(callback, element) {
        var currTime = new Date().getTime();
        var timeToCall = Math.max(0, 16 - (currTime - lastTime));
        var id = window.setTimeout(function() { callback(currTime + timeToCall); },
        lastTime = currTime + timeToCall;
        return id;

if (!window.cancelAnimationFrame)
    window.cancelAnimationFrame = function(id) {
567 Karma
99,506 Total ProTip Views