Lesson 1 Introduction To JavaScript
Lesson 1 Introduction To JavaScript
What is JavaScript?
Add new HTML to the page, change the existing content, and modify styles.
React to user actions, run on mouse clicks, pointer movements, and key presses.
Send requests over the network to remote servers, download and upload files (so-called AJAX and
COMET technologies).
Validate form data entered by the user.
Get and set cookies, ask questions to the visitor, show messages.
Remember the data on the client-side (“local storage”).
JavaScript on a webpage may not read/write arbitrary files on the hard disk, copy them or execute
programs. It has no direct access to OS system functions.
o Modern browsers allow it to work with files, but the access is limited and only provided if the
user does certain actions, like “dropping” a file into a browser window or selecting it via an
<input> tag.
JavaScript from one page may not access the other if they come from different sites (from a different
domain, protocol or port).
JavaScript ability to receive data from other sites/domains is crippled (Though possible, it requires
explicit agreement (expressed in HTTP headers) from the remote side.)
Note: Such limits do not exist if JavaScript is used outside of the browser, for example on a server. Modern
browsers also allow plugin/extensions which may ask for extended permissions.
Lesson 1 jyercia
Introduction to JavaScript Page 2 of 2
The syntax of JavaScript does not suit everyone’s needs. Different people want different features.
That’s to be expected, because projects and requirements are different for everyone.
So recently a plethora of new languages appeared, which are transpiled (converted) to JavaScript before
they run in the browser.
Modern tools make the transpilation very fast and transparent, actually allowing developers to code in
another language and auto-converting it “under the hood”.
CoffeeScript is a “syntactic sugar” for JavaScript. It introduces shorter syntax, allowing us to write
clearer and more precise code. Usually, Ruby devs like it.
TypeScript is concentrated on adding “strict data typing” to simplify the development and support
of complex systems. It is developed by Microsoft.
Dart is a standalone language that has its own engine that runs in non-browser environments (like
mobile apps). It was initially offered by Google as a replacement for JavaScript, but as of now,
browsers require it to be transpiled to JavaScript just like the ones above.
There are more. Of course, even if we use one of these languages, we should also know JavaScript to really
understand what we’re doing.
Summary
JavaScript was initially created as a browser-only language, but is now used in many other
environments as well.
Today, JavaScript has a unique position as the most widely-adopted browser language with full
integration with HTML/CSS.
There are many languages that get “transpiled” to JavaScript and provide certain features. It is
recommended to take a look at them, at least briefly, after mastering JavaScript.
Lesson 1 jyercia