Running Javascript in visual studio code - javascript

I started learning coding in javascript. Wanted to practise my skills using visual studio code but I cannot run the code (to test if it works). Ive spent many hours browsing google to find the setting, but so far I got to this jsconfig.json thing, placed it in my folder where other .js files are, but the .js file with my practice code still doesnt run. I right click in the field with javascript code, press run the code and it still doesnt run. I guess I am still missing something.
Would you be so kind to please advice me step by step what to do?enter image description here

Related

Sublime text editor 3, Not saving But saving

I spent around 6-7 months, trying to learn code a while ago.
Learning the basics of HTML, CSS, javascript, jQuery and a few others.
I have had a break from it for a while as it was
confusing me & other things in life came up.
Now I'm ready to start again.
I have created a simple HTML file & trying to manipulate it via Javascript.
But each time I try and save the javascript file I am getting the following error (Shown in Sublime).
[WinError 2] The system cannot find the file specified
[cmd: ['esvalidate.cmd', '--format=sublime', 'C:\Users\ManDoesNotSubmit\Desktop\Es6NorwichAds\Es6NorwichAdverts.js']]
[dir: C:\Users\ManDoesNotSubmit\Desktop\Es6NorwichAds]
[path: C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\ProgramData\Oracle\Java\javapath;C:\php;C:\WINDOWS\System32\Wbem;C:\PHP]
[Finished]
It is confusing me because when I close sublime & re-open the document,
my new changes have been saved but it is still throwing this error....
I have searched forums, Youtube etc.
But all the responses I have found are regarding Python, Build systems & syntax errors.
Not the specific problem I am having.
I am running windows 10, on a cheap laptop.
I have checked the system environment variables & JS is present in both the extensions & path sections, so I cannot understand why it is throwing an error..
I am opening the file directly into sublime, from my desktop so If it could not find the file, it simply would not load the small amount of script I have written..
Any help would be appreciated.
Sounds like you're missing the sublime-jsvalidate npm package. See here
To be more precise: the error you're getting is about esvalidate.cmd not existing, not the file you're trying to save.

Need help p5.js and Atom Text Editor

Well I recently started off with atom and p5.js well I am very new to JavaScript. Here comes my problem : When I try to run the file it shows me "sketch.js is not a .py file, exit" . I checked the the selection is set to JavaScript but can't figure out what is wrong.. Please Help !
Well the "sketch.js" is the default one which comes with "p5.js" and yes I have installed "node.js" so no issues with that and the problem comes when I edit the "Sketch.js" template and try to run it , it shows saving and after that it says "sketch.js is not a .py file, exit"
You need to isolate your problem. Is the problem in the Atom editor, or is it with P5.js?
Try running your sketch as a standalone .html file that you create with a basic text editor (like JEdit or Notepad, not with Atom). Can you get that working by itself?
Then try running a more basic JavaScript application in Atom. Try simply printing something to the console. If you're still getting the error, then you know it has nothing to do with P5.js.
Isolating your problem like this will help you refine your Google searches, and it will make it easier for people to help you.
Note that P5.js does not require node.js, which runs on a server. It requires regular client-side JavaScript.
I'll also just note that if you're having trouble with stuff like this, it's a good idea to stick with a basic text editor and write and run your code by hand for a while. Code editors hide a lot from you, which can be nice, but not if you're still learning the fundamentals.
You are likely using an editor like Genie or something which runs python programs by default. Have you installed node.js? If not install it and then browse to the directory using command prompt. Then run "C:\Program Files\nodejs\node.exe" file.js

Adding JQuery/Javascript Files to Project

I have a project I am working on at work that is ASP.NET in TFS. I have checked out the solution and have made some adjustments to the code behind with no issues. When I try to add JQuery and a Javascript file to the project, it does it fine in Visual Studio 2012. But when rebuilding and running it won't execute the javascript code. It's like it ignores it. When I put breakpoints in the Javascript file I get the message 'The breakpoint will not currently be hit, no symbols have been loaded for this document'. I simply cannot get the web page to acknowlegde either the JS file, or the JQuery file.
(And yes, I have scoured StackOverflow.com and tried all the suggestions mentioned)
Any suggestions appreciated!

NetBeans: Javascript Code Completion doesn't work as expected

I've just started using NetBeans (PHP version 7.2 for Mac) and love it so far. One thing that I haven't been able to figure out is how to get Code Completion to work for Javascript files in the same fashion as it does for PHP, CSS and HTML files. For example, if I type "fun" in a PHP file, it'll pop up a box that allows me to choose "function":
If I do the same thing in a Javascript file, I get nada:
I've looked all over the place and I have not found a way to add this functionality. Your help would be greatly appreciated.
For this example, try the Source-> Complete Code command (Ctrl+Space by default).
In any case, the JavaScript editor is currently being rewritten from scratch so better code intelligence is to be expected in the near future.
Edit: I almost forget the most obvious answer... Make sure your file belongs to a loaded project. Code intelligence doesn't work properly outside projects.

MVC web app is auto minimizing javascript

I have a project that just happens to be MVC and in Visual Studio 2010. (I don't know if that has anything to do with it, but I'm just trying to be specific in the problem) The issue is that when I build it it is auto minimizing the javascript and as such makes it really hard to debug.
I have looked at the build events and there are none.
I have looked for any vs extensions that could do this and I don't see any out of the ordinary.
I have edited the project file just to make sure nothing was hidden in it.
Does anyone have any ideas as to why this behavior could be happening?
Does your site master just reference a minified js file instead of your development version of the js file?
Thanks to all for trying to help. I found it though. Our company has created an HttpHandler that was configured in the web.config that causes this functionality. I thought I had looked everywhere, but missed this as I was going through it.

Categories

Resources