Help RUN not doing anything for my code in console. I am trying to debug my code

Problem Description:

Hey guys I am new to coding. Anyone know why when I hit “run” i am not getting any feedbacks from the console?

Screenshot(s)/Screen Recording:

Replit RUN not working

Browser/OS/Device: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Replit Profile:

Can you please provide a link to your repl? Welcome to ask by the way!

Hey @RG69! Welcome to the community!

There doesn’t seem to be any console.log()s, try adding them and see if it outputs the result.

It also keeps stopping. @RG69 are you calling the functions?

1 Like

I have caled console.log(‘hi’) not working unfortunately

Is the console.log() inside a function you didn’t call?

If you didn’t, try adding the function name + () outisde the functions.

Can you please provide a link to your repl? That way we can help you easier.

ok, I am trying to find the link. would this suffice?

Your console.log('hi') is inside tester.js, which will not run. It will only run the file index.js.

And it seems that the functions aren’t called in that file either, try calling them and see if it works.

Yes, that is fine. By default (IIRC) replit/node.js will call index.js, if you want it to call something else, you will need to modify the .replit file.

I see so I can only test my codes in the index.js.

I was trying to test smaller functions in a separate js file

You can use your index.js as a file for your functions. You can rename it to functions.js, and add your functions like module.exports = { YOUR, FUNCTIONS, HERE ); at the bottom of your file.

Then, rename tester.js to index.js and then imports the functions by adding require('./functions'); at the top of your file and assigning it to a variable.

From there, you can use the functions like how you would use them as if they are already defined like this:

const functions = require('./functions');

console.log(functions.reverseString('Hello World!')); // '!dlroW olleH'