Challenge Waypoint: Passing Values to Functions with Arguments has an issue.
User Agent is: Mozilla/5.0 (X11; CrOS x86_64 5841.83.0) AppleWebKit/537.36 (KHTML like Gecko) Chrome/36.0.1985.138 Safari/537.36.
Please describe how to reproduce this issue, and include links to screenshots if possible.
My code:
// Example
function ourFunction(a, b) {
console.log(a - b);
}
ourFunction(10, 5); // Outputs 5
// Only change code below this line.
function myFunction(param1, param2) {
console.log(param1+param2);
}
myFunction("booyakasha"," ali pali");
note: myFunction("booyakasha"," ali pali");
Response is:
ok > myFunction should be a function
ok > myFunction(1,2) should output 3
ok > myFunction(7,9) should output 16
not ok > Call myFunction after you define it
note: not ok > Call myFunction after you define it
If my code is:
// Example
function ourFunction(a, b) {
console.log(a - b);
}
ourFunction(10, 5); // Outputs 5
// Only change code below this line.
function myFunction(param1, param2) {
console.log(param1+param2);
}
myFunction(548,958);
note: myFunction(548,958);
Response is:
ok > myFunction should be a function
ok > myFunction(1,2) should output 3
ok > myFunction(7,9) should output 16
ok > Call myFunction after you define it
note: ok > Call myFunction after you define it
Conclusion: result checker considers function not called, even though it is, if strings are passed as parameters.
PS: just checked combination param1 = int, param2 = str; checker returns failure => if at least one param is a string, checker most probably doesn't work in a correct way.

Even if the both parameters are integers it is not working properly.
Here is a proper regex that resolves this issue:
function myFunction[\s\S]+myFunction\([\w\s,"']+\)
I'm having a bit of a hangover, so i'm browsing on my laptop. Because of this, I'm not creating a PR. If someone else wants try, keep in mind that you still need to do the escaping. ;-)
Should the test still pass if the camper only supplies 1 argument for the function? Should there be a separate test to state the camper needs to supply 2 arguments?
Or how about using the same test and changing the wording to something like
Call myFunction after defining it, making sure to give it two arguments.
Fixed the original issue with PR #5713
Also changed the wording of the last test to remind the camper to pass myFunction two arguments.
From:
Call myFunction after defining it.
To:
Call myFunction after defining it, making sure to pass it two arguments.

Thanks Irena. Im still lost on this one. But I really appreciate the help.
ish
// Example
function ourFunctionWithArgs(a, b) {
console.log(a - b);
}
ourFunctionWithArgs(10, 5); // Outputs 5
// Only change code below this line.
function functionWithArgs (c,d){
console.log(c+d);
}
functionWithArgs(7,9);
I'm not sure what I'm doing wrong can someone pls help me?
function FunctionWithArgs(param1, param2) {
console.log(param1 + param2);
}
FunctionWithArgs(1, 2);
FunctionWithArgs(7, 9);
Most helpful comment