question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Functional Programming: Pass Arguments to Avoid... - Correct answer not accepted

See original GitHub issue

Challenge Name

Functional Programming: Pass Arguments to Avoid External Dependence in a Function

Issue Description

Correct answer is not accepted when space between function name and params is not removed.

Browser Information

  • Browser Name, Version: Chrome 63.0.3239.84 (Build oficial) (64 bits)
  • Operating System: Win10
  • Mobile, Desktop, or Tablet: Desktop

Your Code

Not accepted:

function incrementer (val) {
  return val+1;
  // Add your code above this line
}

Accepted:

function incrementer(val) {
  return val+1;
  // Add your code above this line
}

Screenshot

fireshot capture 162 - learn to code i freecodecamp_ - https___beta freecodecamp org_en_c

fireshot capture 164 - learn to code i freecodecamp_ - https___beta freecodecamp org_en_c

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
huyenltnguyencommented, Aug 14, 2018

@Felixr91 There are two ways to use the increment operator: num++ and ++num. The difference between them is when the value is returned. You can read about them here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Increment_()

To fix your code, you can either do

num++;
return num;

or

return ++num;
0reactions
huyenltnguyencommented, Aug 15, 2018

@Felixr91 Glad I can help! To be honest, I had to revisit the page, too, after I saw your comment 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to avoid passing configuration across functions?
I want to allow users to set locale parameter so that they have month names and other data in language of their choice....
Read more >
Pass Arguments to Avoid External Dependence in a Function
In this functional programming tutorial we pass arguments to avoid external dependence in a function. This video constitutes one part of ...
Read more >
Java 8 Functional Programming - Passing function along with ...
My requirement is to wrap every method execution inside timer function which times the method execution. Here's the example of timer function ......
Read more >
Don't Understand Parameters - Codecademy
The neat thing about parameters is that the variables are scoped to the function, making them locally defined. The variable names are arbitrary...
Read more >
The Not-So-Scary Guide to Functional Programming | YLD Blog
A side effect is when a function relies on, or modifies, something outside its parameters to do something. For example, a function which...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found