FANDOM


A page in the
 
Introduction
 
Basics
Statements · Control Flow Statements · Comments · Objects · Functions · Style
Features
Scoping · Inheritance · DOM


It has been suggested that this page or section be merged into Wikibooks:JavaScript. (Discuss)

Programmers need to know how to wield their languages, and language maintainers are typically faithful to document them. But reading through a manual is not always an attractive way to learn, especially for newbies. To fill this niche, numerous JavaScript tutorials already exist on the internet, and they all provide useful information. However, frustration arises when an error or obsolete fact is found and the owners are often less than enthusiastic about updating it. This page represents an attempt to solve this problem the wiki way.

What is JavaScript?Edit

Main article: JavaScript

JavaScript is a language for telling any JavaScript-capable program (typically a browser) what to do (in addition to what it is already programmed to do). It is continually shaped by interoperability.

What can it do?Edit

JavaScript gives HTML designers a programming tool - HTML authors are normally not programmers, but JavaScript is a scripting language with a very simple syntax! Almost anyone can put small "snippets" of code into their HTML pages

JavaScript can react to events - A JavaScript can be set to execute when something happens, like when a page has finished loading or when a user clicks on an HTML element

JavaScript can manipulate HTML elements - A JavaScript can read and change the content of an HTML element

JavaScript can be used to validate data - A JavaScript can be used to validate form input

JavaScript can be used to detect the visitor's browser - A JavaScript can be used to detect the visitor's browser, and - depending on the browser - load another page specifically designed for that browser

JavaScript can be used to create cookies - A JavaScript can be used to store and retrieve information on the visitor's computer

What can it not do?Edit

Tasks JavaScript cannot accomplish are sampled at Dynamic Drive Forums: What you CANNOT do with JavaScript. The reasons all ultimately come down to one thing: encroachment upon someone's rights. There is some overlap, but here are the general categories:

permanent effectsEdit

It cannot write to the server because the savvy user can ultimately control its effects. It can write only cookies to the client because the programmer controls its default behavior and the uninformed user cannot protect his machine in his own power. If JavaScript had permanent effects, they would invade the dominion of their subjects. (E.g., Bob's computer could become a spambot just because he visits a certain website.)

critical featuresEdit

Most browsers allow the user to disable JavaScript, and some firewalls strip it from incoming pages, both for security reasons. Therefore, JavaScript is inherently unreliable. If it were reliable, remote attacks would be easier because the victims who now opt out of the risk (and who might have a higher risk of JavaScript vulnerabilities) could not do so.

secure communicationEdit

Any application which runs on a computer under the control of another party deserves a programmer's suspicion. But this is all the more true for JavaScript applications, because the code may be read and changed at will by the user (whereas most programs would require a complex and unreliable process of decompilation, source-editing, and compilation).

otherwise invasiveEdit

The browser readily queries the page's origin server on behalf of JavaScript, but no similar arrangement applies for the client machine. And JavaScript cannot change the browser's settings.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.