Blog 14 - JavaScript
JavaScript: An Introduction
JavaScript is a programming language that is at the root of the World Wide Web, and has been a core technology alongside languages such as CSS and HTML. According to the usage statistics of JavaScript on the Internet, JavaScript is used on over 97% of websites for its client side purposes. This type of purposes serve the web page behavior, and these JavaScript libraries will often times also include third party libraries alongside its implementation. JavaScript is mostly seen as a high-level language that incorporates just-in-time compilation, and also includes first-class functions, dynamic typing and many more features. APIs are also an important part of JavaScript as it works with regular expressions, the Document Object Model (DOM), and data structures for webpages. To get a better idea of JavaScript in this blog, we will be reviewing its history, website client-side usage, and also touch on some of its many features.
The History of JavaScript
To trace the history of JavaScript we have to look back at the rapid growth of the World Wide Web and the browsers that allowed internet access to the general public. Netscape was a prominent web-browser in the early 1990s that became the most-used, but web pages were still mainly only static. For this reason Netscape hired Brendan Eich to devise a new language with similar syntax to Java while still keeping it relatively simple in terms of scripting. JavaScript was first released as “LiveScript” in September 1995, and its name was then switched to JavaScript that December. Since then, JavaScript was adopted by Microsoft, and the growth and standardization of this programming language dominated in the early 2000s.
A bit later, Google debuted the Google “Chrome” browser which included the V8 JavaScript engine, and was much faster than its competition at the time. This was because of JavaScripts infamous just-in-time compilation, and many internet browsers then decided to make a switch to this growing and efficient technology. Since then, JavaScript has become a staple in the modern programming world, and the creation of Node.js also showed JavaScripts complexity in using JavaScript outside of websites.
Client-Side Usage
Being the dominant client-side scripting language of choice for most of the World Wide Web, JavaScripts ability to embedd scripts in HTML documents and communicate effectively with the DOM provide the following scripted behaviors:
Generating pop-up ads
Playing web-browser games
Keeping data logs on websites regarding user behavior, and providing them to the website owner for analysis
Web-Page Redirection
Validation of user input values on web-forms
Features of JavaScript
Since we will cover a more in-depth review of JavaScript in next weeks blog, we will briefly touch upon some of JavaScripts impressive features. The first is its Imperative and Structured
format, which allows structured programming in the same syntax as C. This includes if statements
, switch statements
, while loops
, and etc. JavaScript is also a programming language that is weakly typed
, which refers to its ability to implicitly cast certain types during compilation. An example of this is that the -
operator can cast both operators to a number. The +
operator can cast both operands to a string but not when they are both numbers, because this operator doubles as the concatenation operator.
Dynamic typing is also an important feature in JavaScript because it allows types to be associated with a value rather an expressions. This allows for variables that might initially be bound to a number to be reassigned for a string. JavaScript also supports type tests such as duck typing
, which can be used to determine if an object is to be used for a certain purpose.
Noted Disadvantages of JavaScript
Although JavaScript has been around since the standardization of the World Wide Web, it is still noted to have disadvantages from programmers and developers that rely on its implementation. One of the most expressed complaints about this programming language is that it does not support integer types. Although the language was written with syntax similar to C, integer type was not supported during its initial release. Automatic semicolon insertion is also a popular complaint because it can cause unexpected behaviors to occur when quickly compiling code in JavaScript. Some of the more recent concerns seem to relate to JavaScripts dependency on global variables. Especially in the age of ever-growing cyber concerns, global variables seem to be avoided to reduce the amount of risk a data breach may have on a website and its logged information. For this reason the existence of global variables seem to not only increase risk of JavaScript implementations, but also cause complications when they are constantly implied. To read more about some disadvantages associated with JavaScript, visit this article on Medium.
Learn More About JavaScript
We are still going to cover more JavaScript in the next blog, but until then feel free to visit JavaScript and read up on their provided resources. Some of these resources include a quick start to JavaScript and advanced techniques in jQuery. You can also visit their learning page to get some quick basic tutorials on JavaScript methods and implementations.
Stay tuned for a new blog post about JavaScript next week!