Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
      <meta charset="utf-8">
      <title>Getting started with QUnit</title>
      <link rel="stylesheet" href="//code.jquery.com/qunit/qunit-1.14.0.css">
   </head>
   <body>
      <div id="qunit"></div>
      <div id="qunit-fixture"></div>
      <script src="//code.jquery.com/qunit/qunit-1.14.0.js"></script>
      <script>
        // Code inlined in the HTML
        // Tests here
        var App = {
    max: function () {
        var max = -Infinity;
        for (var i = 0; i < arguments.length; i++) {
            if (arguments[i] > max) {
                max = arguments[i];
            }
        }
        return max;
    },
    isOdd: function (number) {
        if (typeof number !== 'number') {
            throw Error('The given argument is not a number');
        }
        return number % 2 !== 0;
    },
    sortObj: function (array) {
        array.sort(function (a, b) {
            var date1 = new Date(a.timestamp).getTime();
            var date2 = new Date(b.timestamp).getTime();
            if (date1 < date2) {
                return -1;
            } else if (date1 === date2) {
                return 0;
            } else {
                return 1;
            }
        });
    }
};
      </script>
   </body>
</html>
Output

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers