aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-x2704/main.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/2704/main.js b/2704/main.js
new file mode 100755
index 0000000..db4d727
--- /dev/null
+++ b/2704/main.js
@@ -0,0 +1,25 @@
+#!/usr/bin/env node
+"use strict";
+
+var expect = function (val) {
+ var object = {
+ toBe: function (except) {
+ if (except === val) {
+ return true;
+ } else {
+ throw "Not Equal";
+ }
+ },
+ notToBe: function (except) {
+ if (except !== val) {
+ return true;
+ } else {
+ throw "Equal";
+ }
+ },
+ };
+ return object;
+};
+
+console.log(expect(5).toBe(5)); // true
+console.log(expect(5).notToBe(5)); // throws "Equal"