0

I'm just getting started in JavaScript. I hope you can help me out. I'm trying to call two functions within another function, but it just doesn't seem to work. Nothing shows up on the terminal.

function minusOne(n){
    return --n
}
function triple(n){
    return n*3
}
function tripleMinusOne(n){
    tri=triple(n)
    result = anterior(tri)
    return result
}

res=anteriorDelTriple(9)
console.log(res)
0

2 Answers 2

1

Because there is no function anteriorDelTriple

Sign up to request clarification or add additional context in comments.

1 Comment

OP says nothing shows up in console, should it not throw an error?
1

You have a mismatch in the names of the functions. I'm pointing out the corrections to fix the codebase:

function minusOne(n) {
  return --n
}
function triple(n) {
  return n * 3
}
function tripleMinusOne(n) {
  tri = triple(n)
  result = minusOne(tri) // <-- minusOne instead of anterior
  return result
}

res = tripleMinusOne(9) // <-- tripleMinusOne instead of anteriorDelTriple
console.log(res)

At this moment, you should be receiving an:

Uncaught ReferenceError: anteriorDelTriple is not defined
    at <anonymous>:13:1

error in the console, and that's the reason why res never shows up

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.