Javascript command prompt issue

Hey so learning some Javascript and wanted to know how do I get command prompt to show as $ not c:\user…

And how do I get the file name to show up infront of the dollar sign ex: jungle-king $

hey ,
I think you can not access the files from jaavscript. You can only do that with a backEnd language like PHP or use node.js to do that with console.log('Current directory: ' + process.cwd());

Imma try that ty! Learning

and this is not related to the web. If you mean to do it on a website, you wont get the directory of a user. You will only get the path of the webspace files, never from the users PC. In order to do that on the user pc, you will need the file to be located on the user pc, not on a website.
So python, golang etc… are here my recommendation

Thank you, Right it’s meant to be via the user but I will definitely keep that in mind

Hey so I noticed th a t in VS I’m looking at this guy explain why or how to do Javascript with VS his terminal shows the file name then$ while mine shows just the $

That looks like a command prompt for terminal, nodejs is usually used locally to run JavaScript commands.

You have to open a terminal somehow with visual studio. It is called command prompt in windows the usual terminal

Yea I did but my terminal denotes my laptop and username and the desktop followed by filename instead of like the screenshot i

When I input node index.js it jumps all the way down to the bottom of the terminal and I have to go all the way down to type for some weird reason

If you have git bash installed, you can get that feature by making it your default terminal in VsCode. If you use Mac, OhMyZsh too can help with more customisation

1 Like

Awesome I got git bash for that but it doesn’t make the folder name the name before the $ was kind of wondering how I could do that it still functions the way it should just wasn’t sure what gave the other person the js-basics$ gracias!

Mind elaborating if you have time?

You will have to make a little change to the PS1 value in the .bashrc file. Can’t tell much about that currently as I use ohmyzsh for a while now