FANDOM


Compacting lengthy conditionsEdit

// lengthy
if (x === 'a' || x === 'b' || x === 'c' || x == 'd') {
    console.log(x);
}
 
// same thing but shorter with regex test
if (/^(a|b|c|d)$/.test(x)) {
    console.log(x);
}

Function arguments and applyEdit

function x() {
    console.log("this =", this, "\narguments =", arguments);
}
x(1, 2, 3);
x.apply('this is this', [1, 2, 3]);

Query MediaWiki APIEdit

var url = wgServer + '/api.php?action=query&meta=siteinfo&siprop=statistics&format=json';
 
function cb (data) {
    console.log(data.query.statistics);
}
 
$.getJSON(url, cb);

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.