test (v15)

Revision 15 of this benchmark created on


Setup

var o = {1:1, 2:2};
    var n = 0;
    var s = 'string';
    var arr = [1,2,3,4];
    
    function a(object, key, value){
                if(undefined === object[key]){
                        object[key] = value;
                }
                
                return object[key];
        };
    
    function b(object, key, value){
    return undefined === object[key] ? object[key] = value : object[key];
    };

Test runner

Ready to run.

Testing in
TestOps/sec
1
a(o, 'a', {})
ready
2
b(o, 'a', {})
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.