Why isn't my code running in Sublime Text 3 and Atom?

Why isn't my code running in Sublime Text 3 and Atom?
0

#1

In Sublime Text 3 I try to run the code:

function largestOfFour(arr) {
return arr;
}

console.log(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]));

Then I click on “Build” and the code doesn’t run. Why isn’t it running and how to I Make it run?

The same problem happens with Atom, I install the package “Script” then when I press “Build” is doesn’t run and says “The system cannot find the file specified.[Finished in 0.479s]”.

I Saved it as “.js”.


#2

I don’t use either of those but the code works fine in http://pythontutor.com/javascript.html

You could try making a html file and onload of body run the script file.


#3

It should work on Atom and Sublime just like this online editor. I’m trying to figure that out. Why is it not working!


#4

You mean like these codes? https://www.guru99.com/practical-code-examples-using-javascript.html and save it as HTML?

It also doesn’t work!


#5

This is how I do it:
http://coding.citytravelling.me.uk/arrayReduce.html


#6

I didn’t get it…


#7

What don’t you get?
Did you “view source”?

JavaScript is a language interpreted by the web browser. Or that’s how it was designed. It works with the HTML (markup language) to add extra functionality on the client side.