Last active
October 12, 2021 03:41
-
-
Save McLarenCollege/20f5514302a360b3feee2fa4ef21a82f to your computer and use it in GitHub Desktop.
Exercise Name : Function Trace Foo Bar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//FUNCTION TRACE 3 | |
// Requirements: Create a trace output file showing each function call | |
// including parameter values, and each return value. You should be able | |
// to step through with pen and paper - do not run the code on your computer | |
// Tip: To refresh your memory of how to write trace output, see this gist: | |
// https://gist.github.com/McLarenCollege/e276ecc7dc3485a483be469f61dfd671 | |
function foo(koo, y) { | |
if ((koo % 3) !== 0) { | |
return y === 'hellomax'; | |
} | |
else { | |
return 'max'; | |
} | |
} | |
function bar(x) { | |
let y = 'hello'; | |
if (x + 10 >= 19) { | |
y = foo(6, x) + y; | |
} | |
else { | |
y = y + 'yooo'; | |
} | |
return y; | |
} | |
console.log(!foo(5, bar(10))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment