Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I happened to use a coding platform which didn't give the option to write code in JavaScript but rather gave node as an option. I don't have much experience in Node , so just wanted to know if I could proceed writing the code in pure JavaScript and not face any issues?
Pure JavaScript doesn't get you very far; you need APIs provided by the host environment to allow for most forms of input and output. I mention this because a lot of people confuse "Pure JS" with "JS + Browser supplied APIs".
The APIs provided by Node.js are different to the APIs provided by the runtimes in browsers (the most obvious difference being that if you are writing for a web browser then you'll have a DOM generated by an HTML document to manipulate by default).
That said, there aren't many pure JS features that Node.js lacks.
The only one I can think off of the top of my head is that ES6 modules are not enabled by default since Node.js implemented CommonJS modules before ES6 modules had been added to the specification. You have to enable ES6 modules explicitly if you want to use them.
Node.js is a popular runtime for Javascript. It is one of the ways to run javascript. It's not 'impure' (depending on your definition on pure/impure).
Pure Javascript (Javascript code that does not rely on any libraries that are not defined in the ECMAScript standard) will run in any Javascript environment such as a browser or nodejs that supports the version of ECMAScript you are targeting.
But, pure Javascript can't really do much on its own because it has no display, no file system, no networking, etc... To get some of those things, you need a supporting Javascript environment that has it's own APIs for those types of things.
The supporting environments are generally not compatible. For example, if you want to make an http request to another host, you do that completely differently when running in nodejs versus when running in a browser though you can get a library for nodejs that simulates some browser APIs such as node-fetch simulates the fetch() interface from the browser.
So, it really depends upon what you're trying to do. If a coding platform specifies node, then that's probably because that coding platform relies on other APIs that are specific to node and you will need to use node. For more specific details, we would need to know what the environment is and what the coding project is.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I'm new to JavaScript, and just started learning about Document Object Model.
I came to an understanding that DOM is actually not a "core/default" library of JavaScript rather developed by W3.org as a programmatic model to work with HTML.
I have also learnt that JQuery is also a library built ON TOP of JavaScript just like AngularJS NodeJSN etc.
So my question is:
Does Javascript have a core library?
And is JavaScript actually useful without relying on third-party libraries in 2015?
Are there examples of programs/products that just use Javascript without any third-party libraries?
There is a set of core JavaScript functions, and a specification to detail these functions and their behaviors. This is sometimes known as ECMAScript and common support is for version 5 (aka es-5).
There are a great number of functions available to you in here, from DOM manipulation, creating/modifying arrays and even HTTP requests. Essentially every library that you see, is just a wrapper on top of the core JavaScript functionality to make your life easier.
A great example of this is http://youmightnotneedjquery.com/ which gives examples of how to do things in vanilla JavaScript. Here's a simple comparison from their site:
has class in jQuery
$(el).hasClass(className);
has class in pure JavaScript
if (el.classList)
el.classList.contains(className);
else
new RegExp('(^| )' + className + '( |$)', 'gi').test(el.className);
This quite clearly shows how jQuery can make things easier, but you can also achieve what you want in pure JavaScript.
Does Javascript have a core library?
The language itself doesn't have any means of interacting with anything. It relies on being run in an environment where it can interface with something useful, for example running in a browser and interfacing with the DOM objects.
JavaScript is also used in environments completely different from a browser, like in the web server platform Node.js where the environment allows JavaScript to respond to web requests and access system resources.
Is JavaScript actually useful without relying on third-party libraries
in 2015?
Yes. You can do anything without a third party library that you can do with one, you just need to write more code yourself. Third party libraries are only used for convenience.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm diving into web development again (first time was an utter failure), and I have some pretty spectacular resources for learning both HTML5 and CSS3. What I want to begin studying next is JavaScript so I can have absolute control over my pages. But before I begin integrating JavaScript into my work, I'd like to use JavaScript solely as a programming language (with console I/O and basic programs) to familiarize myself first. What are the best tools for accomplishing this? Because thus far, I haven't found any browser/tool that approaches the simplicity of writing a source file, and clicking run like you might with a C++ program. Thanks.
Node.js is your best shot.
Node is used for:
Server-side applications (Sails, Express, Socket.io)
Various frontend-related scripting (Grunt, LESS)
You can try Node.js, that allows you to run Javascript programs from commandline. Other than that, Javascript runs in a browser.
I think JetBrains makes the best IDEs in the world. Their support of JavaScript, HTML5, and CSS3 is first-rate. I'd recommend looking at WebStorm as your IDE.
I would recommend jsfiddle.net which allows you to type and run code. I might also suggest codecademy.com which has a very good program to teach you javascript and many other languages as well. There is also a really simple part of there website called "codebits" where you can compile js, html, and css and play around. W3schools.com is also very helpful for reference.
If you are running windows, the Windows Scripting Host (WSH) can run both Visual Basic Scripting and JavaScript... with the JavaScript having full access to things.
Because Microsoft supprorted VB Script over JScript (their version of EMCAScript), it is difficult to find documentation, though it does exist. I have a fair number of admin tools written in JScript.
Because that's not how Javascript works. You can't read user input from console.
You can use any browser's development tools and write Javascript code line by line.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I have read this article (Uses of Javascript), while it is right I know there are other uses of javascript, modern javascript nowadays. I haven't read about node.js and how this one works but I have heard that this one makes js do server-side stuffs?
The question is, what are other uses of javascript, can this replace php and ruby? I know this might not be a good idea for enterprise applications but will work well with medium-size applications, am I right?
What are the other uses of javascript other than the one given in the article?
Javascript can very well be used server side. If you're on an IIS server, you can for example use JScript, nodejs, v8cgi (currently known as TeaJS), or a combination of these. On *nix servers nodejs is a popular framework. Nodejs can even be used to program your own webserver (e.g. using the expressjs framework).
Dive in the given links and see what's possible.
There is TESSEL and Espruino javascript inside microcontroller.
I use Node.js for web application for few years, few projects and really happy so far.
The Express.js + MongoDB makes a perfect match (exactly as PHP + MySQL, 5 years ago). You can find reference on MEAN stack.
It works good no only for small applications. We have medium-size app that could be easily scaled up.
Node.js is not to about substitute PHP or Ruby, but what's happening now is indeed, it's more and more used for web applications nowaday. The reason is simple, Node.js has "web-oriented" core, meaning it's originally created to aim highly productive tcp/http applications. With some progress beautiful web development frameworks appeared on top of Node.js that makes web application development even more easy and fun.
For me, programming Node.js on server makes a lot of sense, since JavaScript is main client-side language (almost without alternatives), so context-switching between client/server programming is less. With practice you get use to some initial JavaScript weirdness and things goes smooth and nice.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm looking into the possibilities of creating a Javascript application which makes use webGL.
Since webGL is only available in a couple of browsers, and I do not want to force people to use a certain browser (directly), I would like to offer a standalone app client download aswell.
Would it be possible to somehow create a borderless and standalone "fake browser" client which has my app embedded for both linux and windows?
This would allow me to distribute a standalone client without having to modifiy my application code.
jslibs is a standalone JavaScript runtime that has a good support of OpenGL. Look at these samples.
WebGL support has been offered in WebKit builds for more than a year. So if your clients use Macintosh computers then you could create a standalone application using WebKit.
And that is just for the time being. By next year, I think you will see support for WebGL in every major browser except IE, which is experiencing a dwindling user base.
Alternatively, you could write a plugin/addon for each major browser, including IE. That is more work for you. If you do not want to leave the web standards to the browser makers, you can take up the challenge yourself.
Probably not the best plan in the long term, though. They will continually optimize for speed, memory efficiency, rendering quality, and responsiveness. You probably will not want to put the same amount of continuous effort into it as them. You probably will not offer the same cross platform support they do.
Creating an application specific browser (ASB) with one of the standard toolkits, and then transitioning to using web browsers directly a short ways down the road is probably the way to go. No reason why you cannot work out the compatibility testing for that strategy now, since the browsers with support for it are already in public beta.
So you want to write a standalone platform-independant application in javascript that can use opengl?
I would try making a JOGL application.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I've been wondering to try out server-side javascript for a while. And I'm finding a good amount of servers, like:
Node.js Rhino SpiderMonkey among others.
Could anyone with experience on server-side javascript, tell me which are the best engines? and why? I like the Node.js because it's based on Google's V8 engine. And seems easy to use. But some feedback on what you would choose would be great.
Edit:
Some benchmarks for Node.
I'm thinking on going with this one but feedback is still welcome.
Thanks
I think each solution has its own advantages/disadvantages
here a list of SSJS solutions:
Aptana Jaxer:
sadly abandoned
Sitepoint Persevere:
based on rhino -
include JSDB, supports JSON Query -
by Kris Zyp, the author of JSON Schema
RingoJS:
based on rhino -
ex Helma NG successor of Helma which existed from long time ago -
multi-thread -
nice community -
great actor on CommonJS
Narwhal:
can work on either spidermonkey, V8, or webkit JavaScriptCore -
another great actor on CommonJS -
defined the JSGI API in the Jack Server
Joyent NodeJS:
based on V8
(fast) -
all is running in a single thread -
all the code must be written using callbacks -
lot of modules available via npm (Node Package Manager)
4D Wakanda:
based on Webkit JavaScriptCore aka SFX or Nitro (which has been faster than V8 and could be faster again) -
include an NoSQL Object oriented JavaScript datastore with a native REST API -
multi-threaded -
provides a studio with a debugger, a Model Designer, and a GUI Designer -
provides a Framework with Widgets directly bindable to the datastore and between each others
APE project: based on spidermonkey - a Push engine to synchronize in live data between many visitor browsers
10gen MongoDB: A NoSQL Document store allowing code in either Erlang & JavaScript (using spidermonkey)
Apache CouchDB: Another NoSQL Document store also allowing code in either Erlang & JavaScript (using spidermonkey)
See a Server-Side JavaScript presentation with some history, benchmarks, & descriptions
The word server is badly used. Those are different JavaScript implementations.
Personally the only thing I'm doubtful about these implementations is about the low amount of system libraries. Most of them come with standard stuff (sockets, filesystem etc..) but lack support for Threads and concurrency. That's why I usually use Rhino, unless I care for speed.
It might help to describe what problem you are trying to solve. There are a lot of "server-side" JS implementations that fill various needs. An there also several "server" platforms built around these implementations. I wrote one implementation on top of Rhino and Java Servlets, called Myna. Myna is for web applications, and I detailed some of its advantages in another question.
Are you trying to deploy web applications? Are you trying to script existing code? Does your code need to start quickly from a commandline, or is it going to be implemented as a daemon?
There are currently no clear winners in this space that do all of these things well, but there are good choices for specific needs.