JavaScript

30 Aug 2016

A New Language

Prior to JavaScript the only programming language I knew was Java. I had been programming in Java since high school, so JavaScript was a new experience for me. I first encountered JavaScript this past summer, while developing a web app for the Information and Technology Services department of the University of Hawaii at Manoa. Web applications are a combination of HTML, CSS, and JavaScript. JavaScript is used in web apps mainly to manipulate elements on the html page, and process information. During my Software Engineering course, we were required to complete the JavaScript exercises at freecodingcamp.com. The exercises at freecodingcamp.com are thorough and cover all of the basics of JavaScript. I wish I had discovered these at the beginning of the summer, because I learned some useful information from the exercises.

Differences

While JavaScript’s syntax is similar to Java’s syntax, there are a lot of features that make JavaScript more versatile. When programming in Java, every time you declare a variable you must also declare its type. In JavaScript however, you do not need to declare a type, it will figure out on its own what type of variable it needs to be. JavaScript even makes object oriented programming a little easier. In Java when you define an object it has to be in its own file, and then you have to create and instance of the object. In JavaScript this is all you have to do.

var obj = {
	someProperty : someValue
}

Instead of having a whole file for an object definition, JavaScript can do it in a few lines of code right where you need it. Unlike Java, JavaScript will also let you add, and remove properties whenever you need to. JavaScript also surprised me with the fact that with it, you can return a function from a function, or even pass a function as a parameter. In Java this does not work at all, in fact I didn’t even know it was a possibility. Learning JavaScript has been a fun experience and I am excited to use it more in the future.