Ask coding questions

← Back to all posts
console.log not working
alloverskills

not sure what is happening. It works when there is only one file, but if there are pastes with files in it, nothing happens when printing

Voters
11irishjs
alloverskills
Comments
hotnewtop
[deleted]

your index.js is blank, thats why its not running

alloverskills

@TaylorLiang but what should be in there? i dont get it

[deleted]

@alloverskills require that file, so do require('./exer js/moduleA.js ')

alloverskills

@TaylorLiang Thanks a lot! I know that was a stupid question, but i didn't know that i should require every single file on index.js. I'm still a beginner. Have a nice day!

[deleted]

@alloverskills You have to require files if you want to execute them. Also heres a quick tip: If you want to require functions, like file.function, you have to put the functino in a module.exports = {put functions here}

alloverskills

@TaylorLiang Ok, thanks for the tip!

Kai_Justice

your index.js is blank, that's why its not working.

alloverskills

@Kai_Justice Thanks!

AdCharity

mark @TaylorLiang 's answer if he's right (which he is)