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
If this is not an issue, and since im trying to learn, instead of telling me what im doing wrong could you just point me in the right direction? Thanks!
hi @lmuzquiz it looks like your code is correct. the test suite is using sinon and weird things may be happening. can you remove the last line calculate(8,2,'add'); and test again?
Hello im doing your exercises, to learn JS.
On number 9 you say:
calculate(operation, x, y)
Prints out the equation: (i.e.) "1 + 5 = 6" or "8 / 2 = 4".
Returns the result.
Parameters
operation: string, "add", "subtract", "multiply", or "divide"
x: number
y: number
Returns: number, the result
So i wrote this:
Which i think complies to what you are asking for. (you are asking to print out the equation and return the result). Am i right?
But i get these errors:
AssertError: expected log to be called with exact arguments 4 + 7 = 11
at Object.fail (http://127.0.0.1:8080/lib/js/sinon.js:4758:25)
at failAssertion (http://127.0.0.1:8080/lib/js/sinon.js:4719:20)
at Object.assert.(anonymous function) [as calledWithExactly] (http://127.0.0.1:8080/lib/js/sinon.js:4742:17)
at context. (http://127.0.0.1:8080/test/specs/functions.spec.js:132:20)
at callFn (http://127.0.0.1:8080/lib/js/mocha.js:4387:21)
at Test.Runnable.run (http://127.0.0.1:8080/lib/js/mocha.js:4380:7)
at Runner.runTest (http://127.0.0.1:8080/lib/js/mocha.js:4782:10)
at http://127.0.0.1:8080/lib/js/mocha.js:4860:12
at next (http://127.0.0.1:8080/lib/js/mocha.js:4707:14)
at http://127.0.0.1:8080/lib/js/mocha.js:4717:7
AssertionError: expected undefined to equal 11
at context. (http://127.0.0.1:8080/test/specs/functions.spec.js:145:41)
at callFn (http://127.0.0.1:8080/lib/js/mocha.js:4387:21)
at Test.Runnable.run (http://127.0.0.1:8080/lib/js/mocha.js:4380:7)
at Runner.runTest (http://127.0.0.1:8080/lib/js/mocha.js:4782:10)
at http://127.0.0.1:8080/lib/js/mocha.js:4860:12
at next (http://127.0.0.1:8080/lib/js/mocha.js:4707:14)
at http://127.0.0.1:8080/lib/js/mocha.js:4717:7
at next (http://127.0.0.1:8080/lib/js/mocha.js:4655:23)
at http://127.0.0.1:8080/lib/js/mocha.js:4684:5
at timeslice (http://127.0.0.1:8080/lib/js/mocha.js:5904:27)
Can you clarify?
Thanks in advanced
The text was updated successfully, but these errors were encountered: