Osblog's JavaScript Corner : JavaScript Basics
Discussions on JavaScript
Today I will provide a brief introduction to JavaScript and an explanation of the most basic concepts, including what it can be used for and which technologies go along well with it.
What Is JavaScript?
JavaScript is a cross-platform scripting language that was originally created to add lively content to otherwise dull web pages. It is a lightweight language that works inside a host environment, such as a web browser. JavaScript has its own specification, ECMAScript.
JavaScript uses programs that are called scripts. The scripts can be written in the HTML code and they will execute when the page loads.
Currently JavaScript can execute in browsers (Client-side JavaScript) or on servers (Server-side JavaScript).
The client-side JavaScript allows an application to use the script inside HTML pages and respond to various user events like form input or mouse clicks. Browsers have embedded engines: V8 for Chrome and Opera, SpiderMonkey for Firefox, ChakraCore in Microsoft Edge and SquirreFish for Safari and so on.
The engines work in three simple steps:
It reads the script
It compiles the script into machine language
The machine code runs
Server-side JavaScript supplies the objects needed to run JavaScript on a server. For instance, an extension can allow an application to exchange information with a database or perform various manipulations on the server.
JavaScript and Java
While they have some similarities, JavaScript and Java are fundamentally different. JavaScript uses some of the Java expression syntax and naming conventions and this is why its name was changed from LiveScript to JavaScript.
Compared to Java, it is a very free-form language. Thus, you don’t have to declare all classes,
variables,and methods or have to acknowledge whether the methods are private, publicor protected. Variables, functions,and parameters are not specifically typed in JavaScript.
What Can You Use JavaScript For?
What JavaScript can do depends greatly on the environment that runs it. All in-browser JavaScript engines can do everything that is related to webpage manipulation and user interaction, like:
Respond to various user actions: mouse clicks, key presses, pointer movements
Add new code to the page and customize the page content
Store the data locally, on the client-side
Show messages, set cookies
Download and upload files
What Are the Limitations of JavaScript?
There are several restrictions imposed to JavaScript that ensure the security of the user. These restrictions have been implemented to prevent malicious websites from accessing private information on the client computer or harming the data in any way.
JavaScript can’t read or write files on the hard drive. It doesn’t have any direct access to the operating system or its functions. While modern browsers allow you to manipulate files, the access is permitted only if the user does specific actions, such as dropping a file into a browser window.
Different tabs aren’t connected in any way. Pages from different sites don’t ever know about each other and can’t interact.
JavaScript can only receive data from the server the page came from and not any other domains.
These limitations only exist if JavaScript is used in a browser environment. There are various extensions or plugins that can extend permissions to some websites.
JavaScript is widely used due to its full integration with HTML and CSS. It is supported by all browsers and is usually enabled on the client side.
We will bring more useful information to you, so stay tuned for the next part of Osblog's JavaScript Corner !
Posted on Utopian.io - Rewarding Open Source Contributors
Hey @osblog I am @utopian-io. I have just upvoted you!
Achievements
Suggestions
Get Noticed!
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x
Thank you for the contribution. It has been approved.
You can contact us on Discord.
[utopian-moderator]