开发者

List of things what JavaScript is capable of [closed]

开发者 https://www.devze.com 2023-02-16 15:23 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

I can easily find what Flash or Silverlight capable of, but it's really hard to find what JavaScript can do.

Is there someone who can give me a list of major JavaScript features?

(something like: working with file systems, Web cam support, JSON parsing, socket support, and so on)


Update

If you say that 开发者_运维技巧it depends on platform, then do this: Platform - list of features, Platform - list of features...

The problem is that no one has ever came up with a complete list of features of all the Javascript platforms.


Update

Javascript - is a language.. but in my point of view it's also a client side technology (it was developed as a plugin for browser, same as Flash, same as Silverlight)

Silverlight can work in browser (and i can find list of feature for that 'mode') and OOB (out of browser, and i can also find list of features for that 'mode'), but i can't find list of features for JavaScript... is i the only one who interested in this? :)


I don't think the question is well-posed. Javascript can do anything, as it is Turing complete (in particular any turing complete language can do JSON parsing), but access to external resources (such as sockets or a webcam) is limited to the API which are available on a certain environment.

So it depends on the environment: the answer will be different for a browser, node.js or rhino. If you mean Javascript inside a browser: not much. The basic available API are the DOM and BOM, although with HTML5 there will be some new features for storage and sockets.

EDIT I have read your update, and I think it is unreasonable to ask for the features of every existing environment. Still, it seems to me you are mostly interested in the features of client-side Javascript - i.e. in the browser. Until recently, one was tied with the following two APIs:

  • DOM: allows to traverse and modify the Document Object Model, that is, operates on the content of the current page. It can add div or other elements, change elements style and so on.
  • BOM: the Browser object model. It allows you to operate on browser features which are not tied to the current document, for instance resize the current window. In particular this includes the
  • XMLHttpRequest: allows you to make an HTTP request in the background, it is at the base of all the AJAX-driven application. For security reasons, there are domain restriction on where you can send this request: these are known as the same origin policy.

For obvious security reasons there was (and still there is not) a way to operate on local documents. With the advent of HTML5 there are a number of new API, some of which are still under heavy development. In general you cannot rely on those API on older browers.

This presentation sums up the new goodies which will be available once all clients support HTML5.

Besides the DOM and BOM API you can also make use of Web API's. Note that XMLHttpRequest is a Web API. You can see the complete list at this link: https://developer.mozilla.org/en-US/docs/Web/API.


Flash and Silverlight are both platforms and so have a known list of things the platform supports.

JavaScript is a language not a platform. The list of things it does and does not support, in terms of "working with file systems" or "web cam support" is really dictated by the platform on which you are running the language.

Most people, most of the time, run JavaScript in a web browser, so the list of what it supports is more about what the web browser will let you access with JavaScript.

Generally, this means unrestricted file access is not available (for security reasons). Web cams may be accessible depending on the browser and version.

But overall, I think you might need to re-think the question you are asking, because you may well really mean - "what can I and can't I do from within my web browser's environment". Failing that, you may mean, "what language features does JavaScript support" - in which case you should be able to find a number of descriptions of JavaScript as a language and comparisons to other languages.


Javascript is initially the programming language that interacts with User Interface on a HTML document.

Javascript on DOM / HTML can:

  • Apply, change, unset CSS styles of an element in the document
  • Addition, modification, removal of document elements
  • UI event handling (such as onclick, onchange, etc.)
  • AJAX, JSON, etc.

After years of development and expansion, the language is now dependent on the platform's ability.

For example on Adobe AIR, Javascript's features can be as wide as an average C# application (meaning to say that you can write Javascript to read/write files, web cam, JSON parsing, socket etc.)

Basically my point is, Javascript is ultimately just a language. You can run the same language on multiple platforms, and the objects pre-defined by the platform is accessed by you as the developer using Javascript.


Flash and Silverlight are third party web browser plugins where javascript is built into most browsers (apart form some text based/disablity browsers). Javascript is a client side scripting language which means all the processing is done on your visitors computer.

I can tell you that you cannot work with file systems ie. create/edit/delete files on the server or the clients machine for obvious security reasons. You can parse JSON as it is javascript object notation. You can do form validation though its always best to have server side validation to ensure data quality. The reason you would do validation before the data is submitted is to save a run trip to the server and provide the user with instint feedback like you do with normal desktop applications. You can create charts using javascript and theres always loads of support and tutorials.

What specifically are you looking to do?


Some things that Javascript can do:

  • Handle events. It can catch certain event, (ex. pressing a key), and then execute a function (ex. change size of an element on page);
  • Send requests to server thus interacting with server;
  • Access and manipulate any element on page.

It is also object oriented programming language, thus it supports such concepts as class, inheritance, variables etc.

Some things that Javascript (in browser environment) cannot do:

  • Work with databases;
  • create, modify or remove files;
0

精彩评论

暂无评论...
验证码 换一张
取 消