
JavaScriptSharp: The Language of The Future [by Jack Hughes]
Jack Hughes is a Software Engineering Apprentice at Sky.
Obviously JavaScriptSharp doesn’t actually exist, but if it did, it would build off of the existing JavaScript and improve upon it. JavaScript’s original purpose in life wasn’t always for off-browser adventures but instead to make web pages less static and had a major part to play in the browser war. It may have gotten most of its unique flaws and problems during this time as it was only made to be a scripting language for web browsers. Fortunately, the node environment came along to break JavaScript out of its browser prison, allowing developers to have a language that can be used for both front and back end.
Most people may mock the language and say that it is broken or flawed to which I and other fellow JavaScript developers can confirm that those suspicions are in fact true… except we prefer not to use those parts. I was reading the book How JavaScript Works by Douglas Crockford in which he said “there was, buried deep inside of [JavaScript], a very good language. By avoiding the bad parts, you can write good programs”. This article is not to change your view of JavaScript but instead to show that if we were to create an alternative language that removed these frustrating and broken parts of JavaScript, then it could indeed be the language of the future!
JavaScript’s Funny Quirks

On your first day at school you may learn that one plus one equals two. Well on the first day of JavaScript school you learn that actually true plus true equals two, it’s a strange outcome that you probably expect to still equal true but, because of JavaScript’s implicit declaration, that is not the case. The plus symbol in JavaScript is used to add two numbers or concatenate two strings but what does it do when it isn’t given either of those types? It will automatically convert them into the correct type and in this case ‘true’ as a number is one therefore its logic is flawless, almost. This use of implicit declaration can be quite frustrating and present many bugs that could stump you for hours, but there are some benefits...
The main benefit is that it makes the language much easier to learn as the user does not need to worry about the data types of each of their variables, but the other is that JavaScript won’t just crash and start crying once it hits a problem. If I accidentally converted my number into a string somewhere down the line and then tried to add it to another number, JavaScript will convert my accidentally stringified number back before attempting to add it. The plus symbol being used for both addition and concatenation is a bit of a design flaw, but we’ll leave that issue for JavaScript’s future successor to solve.
JavaScript’s Got Class
The word “object” in JavaScript is used a lot, which is mainly due to everything in the language boiling down to exactly that. A basic description for a JavaScript object is a container with zero or more properties that consist of a name and value. What is wonderful is that the value can store any data type, including functions! You can access most of the values by referencing the object’s variable name followed by a dot, followed by the name assigned to that value also known as the dot notation, it couldn’t be easier.
The concept of everything being an object is why I enjoy using JavaScript, when initialising any data type, you are in fact calling a global class that passes multiple functions, depending on its data type, to help manipulate or change that data. Do you want to sort your array of strings alphabetically? Or extract a substring of an existing string? Then look no further because JavaScript has got the class function for you.
JavaScript’s Truthiness, Whole Truthiness and Nothing But The Truthiness
The result when a given value of any data type is true or not when it’s converted to a boolean is truthiness. For example, the number zero or an empty string is considered false, whereas a number of one or more or a string with one or more characters is considered true. There is some awkward truthiness when evaluating arrays, however. An empty array and an empty object are both considered true, because they exist, but if you were to evaluate the truthiness of their lengths, then you would get false as it would be zero. This may seem as a pain but sometimes it can be useful to determine if a variable contains a value. If my backend returned an array of zero search results and JavaScript saw my empty array as a false value, it could break the program or lead the developer to believe there was an error in the backend.
Conclusion
In conclusion I would say that although JavaScript isn’t the perfect language and definitely can not be used in every situation, its concepts of objects and implicit declaration should be built upon in a second programming language. One where all the current JavaScript problems are resolved, and all the unnecessary and bad features are taken out. This language could be called something like JavaScriptSharp or JS#?
