Function parameters

Question:
Why aren’t my function parameters turning blue and being italicized? Is there a setting I need to change? I want invoke this function and display 8 on the console without using console.log. It seems like my parameters are being interpreted as just variables.
Repl link:
https://replit.com/@augielewis/AngryFlatRegisters#index.js

function addition(num1, num2) {
  let answer = num1 + num2
  return answer
}

addition(3,5)

:wave: Welcome @augielewis!

To the syntax highlighter, yes; they are variables.

1 Like

That’s not how node works, sounds like you’re looking for a Repl with prybar.

1 Like

Replit’s syntax highlighter does not do this automatically.

You might be able to make your own theme

You can try running node in the shell and then typing your code.

This is how NodeJS works, so you cannot change this.

2 Likes

I’m not familiar with prybar, but I’ll look into it. Do you have any amplifying information that might point me in the right direction? Thank you!

The prybar template for node is here, note that this won’t change the execution of files, but it’ll let you run your code in the console, which it sounds like you’re trying to do:

It also won’t change syntax highlighting.

2 Likes

That doesn’t work either. I’m still showing a blank output when I invoke the function using addition(3,5).

Try running it, then calling that function in the Console after it finishes running.

Run on local machine, should be the same on Replit:

C:\Users\Firepup Sixfifty>node
Welcome to Node.js v16.14.2.
Type ".help" for more information.
> function addition(n1, n2) {
... let answer = n1 + n2;
... return answer;
... }
undefined
> addition(3, 5)
8
1 Like

I’ve found out that replit has updated and no longer italicizes function parameters. Also, in the past, you didn’t need to use console.log for it to show up in the console. Now you do. I was watching an instructional video from several years ago. Thank you to everyone who commented on this post and I apologize for any confusion.

4 Likes

Please mark the post as the solution.

1 Like

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