HTMLify

LeetCode - To Be Or Not To Be - JavaScript
Views: 82 | Author: abh
/**
 * @param {string} val
 * @return {Object}
 */
var expect = function(val) {
    return {"toBe":
           function (valu){
               if (valu === val)
                   return true;
               else
                   throw "Not Equal";
           },
            "notToBe":
            function (valu){
               if (valu !== val)
                   return true;
               else
                   throw "Equal";
            }
           }
};

/**
 * expect(5).toBe(5); // true
 * expect(5).notToBe(5); // throws "Equal"
 */

Comments