Im trying to add 2 functions to get a result,I watched the video 10 times and cant get it t

Tell us what’s happening:
Describe your issue in detail here.

Your code so far


function functionWithArgs(1,2){
console.log (1+2)
function functionWithArgs(7,9);
console.log(7+9)}

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36

Challenge: Passing Values to Functions with Arguments

Link to the challenge:

I’m not exactly sure what you are trying to do here based on your code. Could you explain a little more?

You need to read the passage slowly and thoroughly. If you still don’t understand, read it loud (say what you read -this is what I did when I’m stuck, most of the time reading the instruction out loud and slowly helped me comprehend what’s expected). Try to play around with the given example (type the given function example to copy it, then invoke the function you wrote at the bottom, outside the closing curly brace).

Before we use a function, we have to make it first, e.g.:

function testFun(param1, param2) {
  console.log(param1, param2);
}

This is the format for a function that could be used later on:

  • the function’s name is: testFun (we can name it whatever we want)
  • it provides placeholder to hold two values. A variable named param1 to hold the first value, and another variable named param2 to hold the second value. (we can name the variables anything we want instead of param1 and param2, let’s say: number1, string2.
  • what it did with those two variables is to console.log (print it out on our console).

After we made the function, now we can use it. The way to use it is, e.g.:

testFun("Hello", "World") 

When we did that, it prints “Hello World” on our console. Since it is a reusable function, we can invoke the function with other values, e.g. :

testFun(1, 2)  // prints 1 2
testFun("No", "way") // prints No way
testFun("Yo", "Bruh!") // prints Yo Bruh

If we changed the function name, and the variable names

function whatever(meh, ooh) {
  console.log(meh, ooh);
}

then we invoke it, like below, the result is still the same:

whatever(1, 2)  // prints 1 2
whatever("No", "way") // prints No way

Now try it play around. Also compare what you’ve wrote with the example function, testFun. What’s the difference? FCC learning modules content are simple, mostly what we have to do is not that much difference from the given example.

Try invoke your function at the bottom, e.g.:

functionWithArgs(3,4)

What does it says? What’s the error message? Error message helps us to pinpoint what’s the problem with what we wrote. We can google the message too if we’re not familiar with the message.

As a note relevant to this (but not your entire problem), variable name can only be a string, not a number (e.g. 1 or 10). If we want to have a number as a variable name, it has to be as a string (e.g. “1” or “100”)

Im trying to add the numbers and get the correct answer below the curly brackets