User:Jeblad/vector.js

/* testpage */

(function( $ ) {   // bla bla assert    if ( window.console !== undefined && $.isFunction( window.console.assert ) ) {        mw.assert = console.assert;    }    else {        mw.assert = function( bool, msg, obj ) {            if (!bool) {            var callerFunc = arguments.callee.caller.toString; console.log(callerFunc);                var lineNumber = (new Error).lineNumber;                console.log('lineNumber ' + lineNumber);                console.log.apply( this, [ (msg === undefined ? 'Assertion failure' : msg), obj ] );            }        }    }    // affirm is opposite of assert })( jQuery );

$(function{   console.log('assert' + (console.assert ? 'found' : 'missing'));    mw.assert(false === true);    console.log('assert2' + (console.assert2 ? 'found' : 'missing')); });