You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A contract specifies the obligations and guarantees of the behavior from a function or expression at runtime. This acts as a set of rules that are expected from the input and output of a function or expression, and errors are generally reported whenever a contract is violated.
344
344
345
345
```js
346
-
// Define our contract : int -> int
346
+
// Define our contract : int -> boolean
347
347
constcontract= (input) => {
348
348
if (typeof input ==='number') returntrue
349
349
thrownewError('Contract violated: expected int -> int')
0 commit comments