JavaScript Basics: What is JavaScript

Steve Carter
5 min readAug 28, 2021
photo by Tudor Baciu on Unsplash

In this blog, we will go over what JavaScript is and how JavaScript can be added to web pages. There are many different ways to use JavaScript, I will be demonstrating how to use it in three different ways. This is geared towards beginners looking to get started in JavaScript, this will be the first installment of my “JavaScript Basics” series, with many more to follow in hopes to help people start their tech journey. Being a new Software Engineer myself, what better way to get better than teaching what I’ve learned?

What is JavaScript?

JavaScript is a client-side programming language and is used to make a website more dynamic such as animated graphics, interactive maps, and many more. JavaScript is used in all modern websites and is the most popular coding language. Websites are comprised of three layers HTML, CSS, and JavaScript. HTML handles the structure of a website, CSS handles the styling of the website and JavaScript makes it smarter and intelligent by creating a user registration, online shopping, and writing a message. In a nutshell, HTML & CSS are the design side of a website and Javascript is the logic.

Apply JavaScript to your page

You would apply JavaScript to your HTML page (index.html), When applying JavaScript uses one element called <script>. The script is an HTML element used to embed executable code or data normally used for JavaScript. We will go over the different ways to add JavaScript code to your webpage.

Inline Script

An inline script is when you take JavaScript logic and put it inside of your HTML file rather than calling it externally.

add an onclick event handler to create a popup alert

pro: It can save on runtime, it is no longer requires an external file to download from the server-side.

con: Difficult to maintain over time if it’s a multi-page web page, and a challenge to code when it’s passed to multiple developers.

Internal Script

An internal script is JavaScript code placed in the head or the body section of an HTML file.

added a console text using console.log()

pro: can be expanded to do various things like getting data from a database.

con: can not be loaded asynchronously or deferred.

External Script

An external script JavaScript code is contained in an entirely separate external document, with the file extension of .js, this method is standard practice for JaveScript. The external file will be referenced in the HTML document using one of the script tag attributes src= .

external .js file

pro: separating HTML and JavaScript code will help manage the code base better

con: Code can be downloaded using the URL of the .js file. This can help coders steal your code easily.

Why JavaScript?

Popularity

While JavaScript is not the only client-side scripting language on the internet, it was one of the first and is still the most used. Javascript is the most used programming language used by professional developers. More than likely your browser was developed by JavaScript too and seeing that browsers are a needed part of any user’s online experience, goes to show why JavaScript is so significant.

Accessibility

Since Javascript is installed in every web browser today, it relives code newbies from the task of setting up a development environment. It is one of the most accessible entries into coding. The community is one of the largest to offer support and advice. It’s a great language for beginners who want to add to their skillset into other languages, like Python, Java, or C++.

Versatility

JavaScript empowers a programmer to take on any aspect of app design. If you want to get into the client-side (front-end) you can do it with Angular. If you want to get into server-side (back-end) you can throw Node.js in the mix. You can also create desktop, mobile, and web apps with React Native, and React. JavaScript can also help with machine learning as well.

Career Potential

The number of businesses and organizations going digital is increasing therefore a high demand for developers who are familiar with well-known programming languages is needed. As mentioned it’s JavaScript, there’s a shortage of good JavaScript developers. Businesses and other companies are on the hunt for qualified JavaScript developers and are willing to pay well. Statistically, the pay in the United States is $108,864 according to indeed.

For the reasons previously mentioned in this blog, JavaScript is more than worth it to learn if you hope on becoming a web developer. Even if your mind isn’t set on a tech career, being proficient in JavaScript will enable you to build websites from scratch, a useful skill to have in today’s job market!

--

--