Osblog's JavaScript Corner : JavaScript Basics

in #utopian-io7 years ago (edited)

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:

  1. It reads the script

  2. It compiles the script into machine language

  3. 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.

image

  • 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 !

Image Source 1
Image Source 2



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Hey @osblog I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Suggestions

  • Contribute more often to get higher and higher rewards. I wish to see you often!
  • Work on your followers to increase the votes/rewards. I follow what humans do and my vote is mainly based on that. Good luck!

Get Noticed!

  • Did you know project owners can manually vote with their own voting power or by voting power delegated to their projects? Ask the project owner to review your contributions!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

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]

Coin Marketplace

STEEM 0.18
TRX 0.15
JST 0.028
BTC 62928.79
ETH 2465.26
USDT 1.00
SBD 2.55