Basic JavaScript - Passing Values to Functions with Arguments

Tell us what’s happening:
Hi, I have 3 ticks and cannot work out what the last one requires me to do: 2. Call the function with two numbers as arguments.

Your code so far

function functionWithArgs(one, two) {
  console.log(one + two);
}
functionWithArgs("one", "two")

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36

Challenge: Basic JavaScript - Passing Values to Functions with Arguments

Link to the challenge:

Tell us what’s happening:
Hi, I’ve completed 3 of the 4 ticks and have no idea what the final request is asking of me: 2. Call the function with two numbers as arguments.

Your code so far

function functionWithArgs(one, two) {
  console.log(one + two);
}
functionWithArgs("7", "9")

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36

Challenge: Basic JavaScript - Passing Values to Functions with Arguments

Link to the challenge:

you have given two strings to the function, not two numbers. strings are written between quotes, while numbers don’t have the quotes

1 Like

I have merged your two topics, please if you have follow up questions with the same challenge, add a post on the already existing topic, don’t create a new one

1 Like

“7”, “9” are not numbers, they are strings. Strings in JavaScript are represented by single quotes ( ’ ’ ), double quotes ( " " ), or backticks ( ``)

1 Like

Your arguments are “Strings” the exercise needs adds two numbers
Try converting your arguments with parseInt before sum it.

parseInt exercise

1 Like

That is overkill. The values can just be written without the quotes.

The error message is: You should call functionWithArgs with two numbers after you define it.
This means it should be two numbers instead of two strings.
So try replace it with 1 and 2 instead of “one” and “two”.