aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorterminaldweller <devi@terminaldweller.com>2024-01-03 08:19:39 +0000
committerterminaldweller <devi@terminaldweller.com>2024-01-03 08:19:39 +0000
commit767f43ecf3f0331d51a63aacc28da70331c5dcf7 (patch)
treef8e075c68b0aa0674ef3b531b420ae6b4c63241b
parent2125 (diff)
downloadleetcode-767f43ecf3f0331d51a63aacc28da70331c5dcf7.tar.gz
leetcode-767f43ecf3f0331d51a63aacc28da70331c5dcf7.zip
2704
-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"