How do I make an already declared value output 2 different values simultenuously?

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

  **Your code so far**

function functionWithArgs(one, two) {
console.log(1 + 2);


//second sum

  **Your browser information:**

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

Challenge: Passing Values to Functions with Arguments

Link to the challenge:

Hi @emmanuelayotunde !

Welcome to the forum!

I think there is some confusion concerning function parameters.

For the console.log you are not supposed to use real numbers here.

You need to use the parameters instead.

The parameters act as placeholders for the real values.

When we call the function, that is when you will use real values.

functionWithArgs(real-value-goes-here, real-value-goes-here)

Hope that makes sense!

But everytime I do that, I keep getting errors, plus I am really struggling to output two values with the same declaration.

Can you share your latest code so I can see what you are doing?

When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

Ok I understand thanks.

console.log can accespt a number of values. You could just log one value, or you can log several, separating them with commas. Sometimes the value you wanna log, can be result of expression, or even a function retuned value. 1+2 is an expression, so is one+two, given that we declared the values of one and two. In this sense console.log is very useful as it can retrieve us lot of data on what our code produces

let two=2
let three=3
console.log(three, two, 1+2, two+three, 1+two+three)
// logs 3 2 3 5 6

We can even put a descriptive string, to tell us what the log line actually contains:

console.log('show the sum of one and two:', one+two)
console.log('show the sum of one and two: '+(one+two))
console.log('value of one: '+one, 'value of two:', two)

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.