An excerpt of Javascript - part of any web developer’s toolbox

Website Fundamentals: What is JavaScript?

JavaScript is a widely-used, high-level programming language primarily known for its ability to add interactivity and dynamic behavior to websites. JavaScript is a key technology for web development. Almost all web browsers implement it, making JavaScript an essential tool for web modern development.

JavaScript divides developers – some love it and some hate it.

It’s a language which allows developers to create client-side scripts that can be executed within a user’s web browser. This allows developers to manipulate the Document Object Model (DOM) of a web page after the page has loaded. This manipulation of the DOM allows for features such as form validation, animations, interactive content, and real-time updates without the need to constantly request new pages from the server.

Eh?

At the simplest level, this means JavaScript allows you to change a picture and change it to something else when the mouse rolls over it. For a long time that was almost all anyone did with it.

But it’s those two simple processes which are so important – spotting what a user is doing and changing the website in response to that. HTML and CSS allow you to make great-looking pages but they are boring … they just sit there looking good. Before Javascript, to change what the user was looking at involved reloading the whole page which is slow and disruptive.

Well-designed Javascript can make your experience of a website (or an app) much smoother and much more intuitive.

So Why to Some Developers Hate JavaScript?

While JavaScript is a popular and versatile programming language, it is not without its critics, and there are several reasons why some developers might have negative feelings towards it.

There are a lot of things which can make a JavaScript solution appear unreliable – even if it is well written.

  • Inconsistent browser support – JavaScript execution can vary between different web browsers, leading to cross-browser compatibility issues. Developers often have to write code that works correctly in multiple browsers, which can be time-consuming and challenging. As browsers improve and become more consistent, this is less of a problem. Libraries like jQuery also take a lot of guesswork out of browser compatibility.
  • Many purists hate it – (Warning! geek terminology coming up) many more traditional server-side developers find that:
    • Variables can change their data types during runtime. This can lead to unexpected bugs and make it harder to catch errors at compile time, unlike statically typed languages.
    • Global scope and naming conflicts: the use of a global scope can make it susceptible to variable and function name clashes, leading to unintentional overwriting of variables or functions.
  • Callback hell – Because Javascript deals with human interactions, lots of things can happen at lots of different times. This asynchronous behaviour can wrong-foot programming flows. Javascript manages this with what is called a callback (e.g. ‘when the page has loaded and the data loaded, show this button‘). But callbacks, if not well planned, can quickly become unmanageable.
  • Security concerns: Normally the code developers write is not accessible to hackers. But because tech-savvy users can manipulate client-side JavaScript there is more scope for exploiting insecurities. This makes it essential to implement security measures – it can still be a point of concern for some developers.
  • Historical baggage: JavaScript has a history of evolving quickly with various inconsistencies and quirks.
  • Performance challenges: JavaScript’s single-threaded nature can limit its performance, especially when dealing with computationally intensive tasks. Modern web applications often rely on various optimisation techniques to mitigate this issue.
  • Community fragmentation: The script’s ecosystem is vast, with many libraries and frameworks available. This diversity can lead to fragmentation and the need to constantly learn and adapt to new technologies.

It’s important to recognise that developers have addressed many of these issues over the years. Advancements in JavaScript and the development of new tools and libraries have made the whole environment much more reliable.

Additionally, personal preferences and individual experiences also play a significant role in how developers perceive JavaScript. Some developers may simply have different backgrounds and preferences, leading to varying opinions about the language. In any web development agency, you would expect some to be more ‘pro’ than ’anti’.

JavaScript is here to stay

Because it’s is all about interaction, the technology suits interactive websites and applications exceptionally well. Indeed many other languages are becoming more JavaScript-like as they develop.

These days, JavaScript goes beyond web development. It is used in server-side development (Node.js), game development, and various other application types. It has a wide and diverse ecosystem of tools and libraries that make it a versatile language for a wide range of programming tasks. Some languages, like ‘Dart’, are more or less, just variants of JavaScript. Dart is the language behind the Flutter mobile application framework – this is one Google’s many projects.

JavaScript is here to stay.